poj 2840

Published: 15 Jul 2015 Category: 早起一水

一道很简单的数学题,直接上代码:

#include <iostream>
using namespace std;

int main()
{
    int T,hour,minute;
    cin>>T;
    while (T--)
    {
        scanf("%d",&hour);
        getchar();
        scanf("%d",&minute);

        if(minute>0)
        {
            cout<<"0"<<endl;
            continue;
        }

        if(hour<=12)
            cout<<(hour+12)<<endl;

        else
            cout<<(hour-12)<<endl;
    }

    return 0;
}

本篇csdn博客链接

comments powered by Disqus