Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- bool unique(string str)
- {
- sort(str.begin(), str.end());
- for (int i = 0; i < str.length(); i++)
- {
- if (str[i] == str[i + 1])
- {
- return false;
- }
- }
- return true;
- }
- int main()
- {
- long long int i,j,k,m=0,l,n,o=0,p=0,x;
- map<char ,int> ma,mb;
- map<char ,int> ::iterator im;
- string s,c;
- cin>>x;
- for(i=1;i<=x;i++)
- {m=0;
- cin>>n;
- if(n%100==0)
- {
- m = n/100;
- k=m;
- k%=10;
- if(k==1&&(m>20 || m<10))
- {
- cout<<"Case #"<<i<<": "<<m<<"st century!"<<endl;
- }
- else if(k==2&&(m>20 || m<10))
- {
- cout<<"Case #"<<i<<": "<<m<<"nd century!"<<endl;
- }
- else if(k==3&&(m>20 || m<10))
- {
- cout<<"Case #"<<i<<": "<<m<<"rd century!"<<endl;
- }
- else
- {
- cout<<"Case #"<<i<<": "<<m<<"th century!"<<endl;
- }
- }
- if(n%100 != 0)
- {
- m = n/100;
- k=m;
- k%=10;
- if(k+1==1&&(m>20 || m<10))
- {
- cout<<"Case #"<<i<<": "<<m+1<<"st century!"<<endl;
- }
- else if(k+1==2&&(m>20 || m<10))
- {
- cout<<"Case #"<<i<<": "<<m+1<<"nd century!"<<endl;
- }
- else if(k+1==3&&(m>20 || m<10))
- {
- cout<<"Case #"<<i<<": "<<m+1<<"rd century!"<<endl;
- }
- else
- {
- cout<<"Case #"<<i<<": "<<m+1<<"th century!"<<endl;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement