敲响警钟

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

Shiro_Zhu @ 2024-10-06 17:19:10

yyy可能从前一天出发。


by LLVM_lldb_14_0_0 @ 2024-10-06 17:22:10

《绿名绿勾做入门题》


by __int1024 @ 2024-10-06 17:25:16

@LLVM_lldb_14_0_0 不行吗


by I2147483647I @ 2024-10-06 20:52:22

感谢楼主提醒!


by I2147483647I @ 2024-10-06 20:55:23

@LLVM_lldb_14_0_0 该题已经升为普及-。


by LLVM_lldb_14_0_0 @ 2024-10-06 21:34:10

@I2147483647I emmm


by xiaozhengguo123 @ 2024-10-09 20:30:49

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    double a,v;
    double i,n;
    double c,g;
    cin>>a>>v;
    c=ceil(a/v);
    c=c+10;
    i=floor(c/60);
    n=c-i*60.0;
    if(n!=0)
    {
        n=60-n;
        i=8-1-i;
        if(i<0)
        {
            i=24-abs(i);
        }
    }
    if(n==0)
    {
        i=8-i;
        if(i<0)
        {
            i=24-abs(i);
        }
    }
    if(i>=10&&n>=10)
    {
        cout<<i<<":"<<n<<endl;
    }
    if(i>=10&&n<10)
    {
        cout<<i<<":"<<"0"<<n<<endl;
    }
    if(i<10&&n>=10)
    {
        cout<<"0"<<i<<":"<<n<<endl;
    }
    if(i<10&&n<10)
    {
        cout<<"0"<<i<<":"<<"0"<<n<<endl;
    }
    return 0;
}

by xiaozhengguo123 @ 2024-10-09 20:31:29

@Shiro_Zhu


by Shiro_Zhu @ 2024-10-14 09:15:57

@LLVM_lldb_14_0_0 有的时候会觉得自己被红题玩弄了。


by Shiro_Zhu @ 2024-10-14 09:17:48

@xiaozhengguo123 你的思路好复杂。

#include<bits/stdc++.h>
using namespace std;

int main(){
//  freopen(".in","r",stdin);
//  freopen(".out","w",stdout);
    int s,v;
    cin>>s>>v;
    int t=s/v;
    if(t*v<s) t++;
    int ans=480-t-10;
    if(ans<0) ans=1440+ans;
    int ansh=ans/60,ansm=ans%60;
    if(ansh<10) cout<<"0";
    cout<<ansh<<":";
    if(ansm<10) cout<<"0";
    cout<<ansm;
    return 0;
}

|