codeforces108A

2021/10/27 23:11:39

本文主要是介绍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

 



这篇关于codeforces108A的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程