请大佬们看看为什么编译错位

P5707 【深基2.例12】上学迟到

SQH2004 @ 2024-09-28 20:56:09

#include<stdio.h>
int main(){
    int s,v;
    scanf("%d %d",&s,&v);
    int t=s/v;
    if(s%v=0){
        int shi=(t+10)/60;
        int fen=(t+10)%60;
        if(t+10<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
              else printf("0%d:0%d",8-shi,60-fen);}
            else if(fen<=50){
                if(32-shi>=10)
                printf("%d:%d",32-shi,60-fen)
                else printf("0%d:%d",32-shi,60-fen)
                }
        else if(fen>50){
            if(32-shi>=10)
            printf("%d:0%d",32-shi,60-fen)
            else printf("0%d:0%d",32-shi,60-fen)}
    }
    else {
        int shi=(t+11)/60;
        int fen=(t+11)%60;
        if(t+11<=480){
            if(fen<=50)
              printf("0%d:%d",8-shi,60-fen);
            else printf("0%d:0%d",8-shi,60-fen);}
        else if(fen<=50){
            if(32-shi>=10)
                printf("%d:%d",32-shi,60-fen)
            else printf("0%d:%d",32-shi,60-fen)}
        else if(fen>50){
            if(32-shi>=10)
            printf("%d:0%d",32-shi,60-fen)
            else printf("0%d:0%d",32-shi,60-fen)}
    }
    return 0;

}

by Mu_Cheng_L @ 2024-10-21 23:55:52

@SQH2004 布什哥们

#include<iostream>
#include<stdio.h>
using namespace std;

int s,v,cnt,t;

int main(){
    cin>>s>>v;
    cnt=(s-1)/v+11;
    if(cnt>480)t=1920-cnt;
    else t=480-cnt;
    printf("%02d:%02d",t/60,t%60);
    return 0;
}```cpp
#include<iostream>
#include<stdio.h>
using namespace std;

int s,v,cnt,t;

int main(){
    cin>>s>>v;
    cnt=(s-1)/v+11;
    if(cnt>480)t=1920-cnt;
    else t=480-cnt;
    printf("%02d:%02d",t/60,t%60);
    return 0;
}

没了,输出用的填充0


by Mu_Cheng_L @ 2024-10-21 23:59:30

@SQH2004 不小心复制了两遍,你自己看一下


上一页 |