⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stu3002.txt

📁 北京大学 在线acm在线判题系统 一些题目解答
💻 TXT
字号:
/*
   农夫三拳@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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -