stu3002.txt
来自「北京大学 在线acm在线判题系统 一些题目解答」· 文本 代码 · 共 53 行
TXT
53 行
/*
农夫三拳@seu
drizzlecrj.gmail.com
2007-03-02
*/
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
bool assigned[26];
unsigned long N;
string argument;
int i;
while(cin >> N)
{
memset(assigned, false, sizeof(assigned));
assigned[0] = true;
for(i = 0; i < N; i++)
{
cin >> argument;
assigned[argument.at(0) - 'a'] = assigned[argument.at(2) - 'a'];
}
bool state = true;
for(i = 0; i < 26; i++)
{
if(assigned[i])
{
state = false;
cout << static_cast<char>(i + 'a');
break;
}
}
i++;
for(; i < 26; i++)
{
if(assigned[i])
{
cout << ' ' << static_cast<char>(i + 'a');
}
}
if(state)
cout << "none" ;
cout << endl;
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?