标签:otto math style multi one img each 数位 ++
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 495 Accepted Submission(s): 162
#include <cstdio> #include <algorithm> #include <iostream> #include <cstring> using namespace std; int main(){ int T; scanf("%d",&T); while(T--){ int hh,mm; scanf("%d%d",&hh,&mm); char str[100]; scanf("%s",str); int len=strlen(str); int flag=0; int th=0; int tm=0; if(str[3]==‘+‘){ for(int i=4;i<len;i++){ if(str[i]==‘.‘){ flag=i; break; } th=th*10+str[i]-‘0‘; } if(flag!=0){ tm=str[flag+1]-‘0‘; mm+=((tm*60)/10); if(mm>=60){ mm-=60; th++; } } hh+=(th-8); if(hh>=24) hh-=24; if(hh<0) hh+=24; if(hh<10) cout<<"0"; //前导零 cout<<hh<<":"; if(mm<10) cout<<"0"; cout<<mm<<endl; }else { int tth=0; int th=16; for(int i=4;i<len;i++){ if(str[i]==‘.‘){ flag=i; break; } tth=tth*10+str[i]-‘0‘; } th-=tth; if(flag!=0){ tm=str[flag+1]-‘0‘; mm-=((tm*60)/10); if(mm<0){ mm+=60; th--; } } hh+=th; if(hh>=24) hh-=24; if(hh<10) printf("0"); printf("%d:",hh); if(mm<10) printf("0"); printf("%d\n",mm); } } return 0; } /* 01 14 UTC+2.6 19:50 */
标签:otto math style multi one img each 数位 ++
原文地址:https://www.cnblogs.com/buerdepepeqi/p/9357330.html