1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #include <bits/stdc++.h> using namespace std; string s; int ans; inline string r(string n){string k="";for (int i=n.size()-1;i>=0;i--)k+=n[i];return k;} int main(void){ cin>>s; while (s!=r(s)){ ans++; s[4]++; if (s[4]>'9')s[4]='0',s[3]++; if (s[3]>='6')s[3]=s[4]='0',s[1]++; if (s[1]>'9')s[1]='0',s[0]++; if (s[0]=='2'&&s[1]=='4')s[0]=s[1]='0'; } cout<<ans; }
|