gugula @ 2023-09-02 23:05:10
#include<stdio.h>
int main() {
int s,v,h,m,hh,mm;
scanf("%d%d",&s,&v);
int t=s/v+10;
if(s%v!=0){
t++;
}
if(t>=60){
h=t/60;
m=t%60;
}else if(t<60){
h=0;
m=t;
}
if(m<60&&m!=0){
if(7-h>0){
hh=7-h;
mm=60-m;
}else if(7-h<0){
hh=24+7-h;
mm=60-m;
}
}else if(m==0){
if(8-h>0){
hh=8-h;
mm=0;
}else if(8-h<=0){
hh=24+8-h;
mm=0;
}
}
if(hh<=8&&hh>0&&mm>=10){
printf("0%d:%d",hh,mm);
}else if(hh<=8&&hh>0&&mm<10){
printf("0%d:0%d",hh,mm);
}else if(hh<24&&hh>8&&mm>=10){
printf("%d:%d",hh,mm);
}else if(hh<24&&hh>8&&mm<10){
printf("%d:0%d",hh,mm);
}else if(h==8){
if(mm>=10){
printf("23:%d",mm);
}else if(mm<10&&mm>0){
printf("23:0%d",mm);
}if(mm==0){
printf("00:00");
}
}
return 0;
}
```cpp
by xuyi20110411 @ 2023-09-02 23:55:29
#include <bits/stdc++.h>
using namespace std;
int main(){
double s,v,t;
cin>>s>>v;
t=ceil(s/v)+10;
int n;
n=24*60+8*60;
n-=t;
if(n>24*60){
n-=24*60;
int h=n/60;
int m=n%60;
if(m>=10){
cout<<"0"<<h<<":"<<m;
}else{
cout<<"0"<<h<<":"<<"0"<<m;
}
}else{
int h=n/60;
int m=n%60;
if(h>=10){
if(m<10){
cout<<h<<":"<<"0"<<m;
}else{
cout<<h<<":"<<m;
}
}else{
if(m<10){
cout<<"0"<<h<<":"<<"0"<<m;
}else{
cout<<"0"<<h<<":"<<m;
}
}
}
return 0;
}
by xuyi20110411 @ 2023-09-02 23:55:55
自己体会
by xuyi20110411 @ 2023-09-02 23:57:45
你这太复杂,就把入门那几天的答案拿来给你参考了
by xuyi20110411 @ 2023-09-02 23:58:54
特判太多,yi!chu!cuo!
by GipsyAvenger1 @ 2023-09-03 15:51:46
#include <bits/stdc++.h>
using namespace std;
int s, v, wt, gt, gh, gm;
int main(){
cin >> s >> v;
wt = s/v;
if(s%v!=0)
wt++;
gt = (480 + 2880 - 10 - wt)%1440;
gh = gt/60;
if(gh<10)
cout << 0;
cout << gh << ':';
gm = gt%60;
if(gm<10)
cout << 0;
cout << gm << endl;
return 0;
}