CodeForces 816A Karen and Morning
2017-09-26 20:56
309 查看
CodeForces很良心,每个点都给数据,我已经不知道交了多少次了Orz
这题就是看错误点,慢慢加特判,一个一个加,最后总会A的(笑
这题就是看错误点,慢慢加特判,一个一个加,最后总会A的(笑
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <string> using namespace std; const int maxn = 100010; int h1, h2, m1, m2; string h,m; string time ,hour; int main() { char aaa; string aa; cin >> aa; for(int i=0; i<5; i++) { if(i<2) h += aa[i]; else if (i>=3) m += aa[i]; } int mmz = (m[0] - '0') *10 + m[1]- '0'; int mmn = (m[1]- '0') *10 + m[0]- '0'; int hhz = (h[0]- '0') *10 + h[1]- '0'; int hhn = (h[1]- '0') *10 + h[0]- '0'; if(hhz == mmn) { puts("0"); return 0; } if(mmz < hhn) { if(hhn <= 60 && hhz!=6) { cout << hhn - mmz; return 0; } else if(hhz==6){ int x = 60-mmz; int y = (10 - hhz - 1) * 60; cout << x+y+1; } else if(hhz > 15 && hhz < 20) { int x = 60-mmz; int y = (20 - hhz - 1) * 60; cout << x+y+2; return 0; } else if(hhz>=6&&hhz<10) { int x = 60-mmz; int y = (10 - hhz - 1) * 60; cout << x+y+1; return 0; } } if(mmz > hhn && hhz !=23) { if(hhz >= 15 && mmz > hhn && hhz<20) { int x = 60-mmz; int y = (20 - hhz - 1) * 60; cout << x+y+2; return 0; } if(hhz+1<6||hhz>=10) { cout << 60-mmz+ (h[1]- '0'+1) *10 + h[0]- '0'; return 0; } if(hhz < 15) { int x = 60-mmz; int y = (10 - hhz - 1) * 60; cout << x+y+1; return 0; } } if(hhz == 23){ cout << 60 - mmz; return 0; } return 0; }
相关文章推荐
- Codeforces 659A Round House (模拟)
- CodeForces 19D Points(线段树+map)
- Codeforces 768A Oath of the Night's Watch
- codeforces 834 D. The Bakery
- CodeForces 447-A. DZY Loves Hash
- codeforces 492D. Vanya and Computer Game
- codeforces 18D Seller Bob DP
- CodeForces 679B Bear and Tower of Cubes
- Codeforces 396B:On Sum of Fractions
- Diplomas and Certificates (Codeforces - 818A)
- [Codeforces] 347B - Fixed Points
- CodeForces 401C Team
- codeforces 659B Qualifying Contest
- Codeforces 708B. Recover the String
- Codeforces 415D Mashmokh and ACM DP
- Codeforces 441E Valera and Number 概率DP
- Codeforces Div. 2 #259-B. Little Pony and Sort by Shift
- CodeForces 131D Subway [tarjan+最短路]
- Codeforces 444C DZY Loves Colors(线段树)
- Codeforces 712C Memory and De-Evolution