zoukankan      html  css  js  c++  java
  • 2670 时间计算

    2670 时间计算

     

     时间限制: 2 s
     空间限制: 32000 KB
     题目等级 : 黄金 Gold
     
     
    题目描述 Description

    假设现在是2013年1月1日0:00分00秒,现在给出一个秒数S,求过S秒后时那年那月那日几时几分几秒.(设每月30天)

    输入描述 Input Description

    (多数据)  每行一个正整数S,当S=0时,输入结束。

    输出描述 Output Description

    每行以XnXyXrX:X:X(小时化为24小时制)

    样例输入 Sample Input

    5

    100

    86400

    0

    样例输出 Sample Output

    2013n1y1r00:00:05

    2013n1y1r00:01:40

    2013n1y2r00:00:00

    数据范围及提示 Data Size & Hint

    【数据范围】

    对于50%的数据  S≤20,000, 数据组数≤1000

    对于100%的数据  S≤100,000, 数据组数≤5000

    【提示】

    0:00:05按0: 0:5输出算错

    分类标签 Tags 

    注意题目要求,数据范围

    #include<cstdio>
    using namespace std;
    int n,y,m,d,shi,fen,miao;
    int main(){
        while(1){
            scanf("%d",&n);
            if(n==0)return 0;
            y=m=d=shi=fen=miao=0;
            y=n/31104000;
            n%=31104000;
            m=n/2592000;
            n%=2592000;
            d=n/86400;
            n%=86400;
            shi=n/3600;
            n%=3600;
            fen=n/60;
            n%=60;
            miao=n;
            printf("%dn%dy%dr",y+2013,m+1,d+1);
            if(shi<10)printf("0%d:",shi);
            else printf("%d:",shi);
            if(fen<10)printf("0%d:",fen);
            else printf("%d:",fen);
            if(miao<10)printf("0%d
    ",miao);
            else printf("%d
    ",miao);
        }
        return 0;
    }
  • 相关阅读:
    Android中 requestCode与resultCode的区别与用法
    Activity与Fragment之间的通信
    关于解决 从相册中选择照片后无法剪切图片以及无法加载图片的问题
    Codeforces Round #313 (Div. 2) C. Geralds Hexagon
    HDU 2669 Romantic
    HDU 1405 The Last Practice
    HDU Wolf and Rabbit
    LightOJ 1104 Birthday Paradox
    11181
    Tr A
  • 原文地址:https://www.cnblogs.com/shenben/p/5517256.html
Copyright © 2011-2022 走看看