首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Ctime函数 在ACM中的使用

2013-04-12 
Ctime函数 在ACM中的应用咱们从一个题目开始进行导入http://acm.nbut.cn/Contest/view/id/38/problem/C.xh

Ctime函数 在ACM中的应用

  • 咱们从一个题目开始进行导入
  • http://acm.nbut.cn/Contest/view/id/38/problem/C.xhtml

  • [C] Minary Fights with Time
  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Minary is busy now. As a result, she's fighting with time.
    To serialize every time point she marked, she decide to make every time point to an integer.

    You can imagine that 1970-01-01 00:00:00 GTM(Greenwich Mean Time) is the start. Give you an integer that indicates the total seconds from that time, you should output the time it stands for.

  • 输入
  • This problem contains several cases, input until EOF.
    Every case is an integer(-2^31 ~ 2^31-1) that indicates the total seconds from 1970-1-1 00:00:00 GTM.
  • 输出
  • For every case, you should output its time.
  • 样例输入
  • 0111111111113635924692147483647
  • 样例输出
  • 1970-01-01 00:00:002005-03-18 01:58:312013-03-18 07:41:092038-01-19 03:14:07
  • 提示
  • 来源
  • Minary

    题意: 输入从1970-01-01 00:00:00 到现在的秒数  问现在的时间是什么

    #include<stdio.h>#include<string.h>#include<time.h>int main( void ){    struct tm *newtime;    char tmpbuf[128];    time_t lt1;time( <1 );//获得当前时间    newtime=localtime(<1);//转换成当地时间strftime( tmpbuf, 128, "Today is %A, day %d of %B in the year %Y.\n", newtime);    printf(tmpbuf);return 0;}




热点排行