码迷,mamicode.com
首页 > 其他好文 > 详细

ACM/CF赛制getstart模板

时间:2014-10-04 01:11:35      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   ar   for   sp   div   

 

(包含整型变量快速读入、简易循环和连续容器的迭代器循环的宏定义、调试时的运行时间输出(编译选项应有“DEBUG”宏定义)等)

 

 1 /*=============================================================================================================================*/
 2 /*======================================================Code by Asm.Def========================================================*/
 3 /*=============================================================================================================================*/
 4 #include <cstdio>
 5 #include <iostream>
 6 #include <algorithm>
 7 #include <cmath>
 8 #include <cctype>
 9 #include <memory.h>
10 #include <vector>
11 #include <set>
12 #include <string>
13 #include <cstring>
14 #include <map>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <ctime>
19 #include <iterator>
20 #include <functional>
21 #include <cstdlib>
22 using namespace std;
23 /*===================================================CONVENIENT DIFINATIONS====================================================*/
24 #define forall(it,v) for(__typeof(v.begin()) it = v.begin();it < v.end();++it) 
25 #define pb push_back
26 #define REP(i,j,k) for(i = j;i <= k;++i)
27 #define REPD(i,j,k) for(i = j;i >= k;--i)
28 /*===========================================================TYPES=============================================================*/
29 typedef long long LL;
30 
31 /*======================================================GLOBAL VARIABLES=======================================================*/
32 
33 /*==========================================================FUNCTIONS==========================================================*/
34 template<typename T>
35     void getint(T &x){
36     char c = getchar();
37     while(!isdigit(c)))c = getchar();
38     x = c - 0;
39     while(isdigit(c = getchar())x = x * 10 + c - 0;
40 }
41 void work(int T){
42     
43 }
44 
45 int main(){
46     srand((int)time(0));
47     #ifdef DEBUG
48     assert(freopen("test","r",stdin));
49     #endif
50     //--------------------------------------------------variables-----------------------------------------------------------
51     int T,i;
52     //-----------------------------------------------------work-------------------------------------------------------------
53     getint(T);
54     REP(i,1,T)work(i);
55 
56     //----------------------------------------------------------------------------------------------------------------------
57     #ifdef DEBUG
58     cout << (double)clock() / CLOCKS_PER_SEC <<endl;
59     #endif
60     return 0;
61 }
62 /*=============================================================================================================================*/

ACM/CF赛制getstart模板

标签:style   blog   color   io   os   ar   for   sp   div   

原文地址:http://www.cnblogs.com/Asm-Definer/p/4005406.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!