#28105: ???其他是什麼奇怪解法


jeremydingeric@gmail.com (164253)

學校 : 臺北市立成功高級中學
編號 : 158900
來源 : [42.77.7.4]
最後登入時間 :
2025-09-19 21:00:26

看到有人都換成分,加150再換回來

還有一堆if else if

為什麼不用直覺一點的解法

int n,m;

 scanf("%d %d",&n,&m);

 n+=2;

 m+=30;

 if(m>59){

  m%=60;

  n++;

 }

 n%=24;

 printf("%02d:%02d",n,m);

#28106: Re:???其他是什麼奇怪解法


jeremydingeric@gmail.com (164253)

學校 : 臺北市立成功高級中學
編號 : 158900
來源 : [42.77.7.4]
最後登入時間 :
2025-09-19 21:00:26

再壓了一下

#include <stdio.h>

void main(){

 short int n,m;

 scanf("%hd %hd",&n,&m);

 printf("%02hd:%02hd",(n+2+(m+30)/60)%24,(m+30)%60);

}