NYOJ 484 The Famous Clock

地址:http://acm.nyist.net/JudgeOnline/problem.php?pid=484

代码如下:

 1 #include<iostream>

 2 #include<cstdio>

 3 #include<cstring>

 4 using namespace std;

 5 int main()

 6 { 

 7     int n=0,k;

 8     string a;

 9     while(cin>>a)

10     {

11         printf("Case %d: ",++n);

12         if(a=="I")cout<<1<<endl;

13         else if(a=="II")cout<<2<<endl;

14         else if(a=="III")cout<<3<<endl;

15         else if(a=="IV")cout<<4<<endl;

16         else if(a=="V")cout<<5<<endl;

17         else if(a=="VI")cout<<6<<endl;

18         else if(a=="VII")cout<<7<<endl;

19         else if(a=="VIII")cout<<8<<endl;

20         else if(a=="IX")cout<<9<<endl;

21         else if(a=="X")cout<<10<<endl;

22         else if(a=="XI")cout<<11<<endl;

23         else cout<<12<<endl;

24     }

25     return 0;

26 }

你可能感兴趣的:(Lock)