codeforces108A

sol:暴力每次加一分钟

printf(“%02d",a)

表示不到两位左边补0

#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
    ll s=0; bool f=0; char ch=' ';
    while(!isdigit(ch)) {f|=(ch=='-'); ch=getchar();}
    while(isdigit(ch)) {s=(s<<3)+(s<<1)+(ch^48); ch=getchar();}
    return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
    if(x<0) {putchar('-'); x=-x;}
    if(x<10) {putchar(x+'0'); return;}
    write(x/10); putchar((x%10)+'0');
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
int a,b;
inline int sb(int x)
{
    return x%10*10+x/10;
}
int main()
{
    R(a); R(b);
    while(233)
    {
        b++;
        if(!(b%60))
        {
            b=0; a++;
        }
        a%=24;
        if(a==sb(b)) 
        {
            printf("%02d:%02d\n",a,b); return 0;
        }
    }
    return 0;
}
View Code

 

posted @ 2021-10-27 22:51  yccdu  阅读(35)  评论(1编辑  收藏  举报