08 2013 档案
摘要:描述2010年上海世界博览会(Expo2010),是第41届世界博览会。于2010年5月1日至10月31日期间,在中国上海市举行。本次世博会也是由中国举办的首届世界博览会。上海世博会以“城市,让生活更美好”(Better City,Better Life)为主题,将充分探索21世纪城市生活。这次世博会总投资达450亿人民币,创造了世界博览会史上的最大规模记录。吸引200个国家和国际组织参展。预计有7000万人次的参观者。为了更好地接待在这期间来自世界各地的参观者,如何合理安排各宾馆的住房问题提到了日程。组委会已接到了大量的客户住宿定单,每张定单的内容包括要住宿的房间数,开始住宿时间和要住的天数
阅读全文
摘要:描述某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。 由于马路上有一些区域要用来建地铁。这些区域用它们在数轴上的起始点和终止点表示。 已知任一区域的起始点和终止点的坐标都是整数,区域之间可能有重合的部分。现在要把这些区域中的树(包括区域端点处的两棵树)移走。聪明的小明干了一件又一件事,他觉得这个很有意思,就想用计算机来帮助建筑工人统计这些树,现在任务来了,计算将这些树都移走后,马路上还有多少棵树。输入第一行是一个整数N表示有N组测试数据(...
阅读全文
摘要:描述把分数按下面的办法排成一个数表。1/1 1/2 1/3 1/4.....2/1 2/2 2/3....3/1 3/2 ....4/1..... .........我们以z字型方法给上表的每项编号。特定方法:第一项是1/1,然后是1/2、2/1、3/1、2/2、1/3、1/4、2/3……。编程输入项号N(1 4 int main() 5 { 6 int m, n, sum, i, d; 7 scanf("%d", &m); 8 while(m--){ 9 10 scanf("%d", &n);11 sum = 0;12 ...
阅读全文
摘要:描述 N!阶乘是一个非常大的数,大家都知道计算公式是N!=N*(N-1)······*2*1.现在你的任务是计算出N!的位数有多少(十进制)?输入首行输入n,表示有多少组测试数据(n 2 #include 3 int main() 4 { 5 int n, i, x; 6 double sum; 7 scanf("%d", &n); 8 while(n--){ 9 10 sum = 1;11 scanf("%d", &x);12 for(i = 1; i <= x; i++
阅读全文
摘要:超时#include #include #define M 1000001int shu[M];int main(){int n, x, i, j, p, e, m;scanf("%d", &n);while(n--){ memset(shu, 0, sizeof(shu));shu[1] = 1;scanf("%d", &x);#if 0for(i = 1, p = 1; i = 10){shu[j+1] = shu[j] / 10;shu[j] %= 10;p++;}}}#endifp = 1;for(i = 1; i <= x
阅读全文
摘要:1 #include 2 #include 3 #define M 100001 4 5 struct time 6 { 7 int a; 8 int b; 9 }flower[M];10 11 int visit[M];12 13 int cmp(const void *x, const void *y)14 {15 struct time *m = (struct time *)x;16 struct time *n = (struct time *)y;17 return m->a - n->a;18 }19 20 int main()21...
阅读全文
摘要:1 #include 2 #define M 301 3 int r[M], c[M]; 4 5 int main() 6 { 7 int k, m, n, i, j, sum, flag, t; 8 scanf("%d", &k); 9 while(k--){10 11 sum = 0;12 scanf("%d %d", &m, &n);13 for(i = 1; i c[i])51 {52 for(j = 1; j c[i])60 ...
阅读全文
摘要:描述学校的小礼堂每天都会有许多活动,有时间这些活动的计划时间会发生冲突,需要选择出一些活动进行举办。小刘的工作就是安排学校小礼堂的活动,每个时间最多安排一个活动。现在小刘有一些活动计划的时间表,他想尽可能的安排更多的活动,请问他该如何安排。输入第一行是一个整型数m(m 2 #include 3 #define M 10001 4 5 struct time 6 { 7 int a; 8 int b; 9 }actv[M];10 11 int cmp(const void *a, const void *b)12 {13 struct time *m = (struc...
阅读全文
摘要:描述给你一个非负数整数n,判断n是不是一些数(这些数不允许重复使用,且为正数)的阶乘之和,如9=1!+2!+3!,如果是,则输出Yes,否则输出No;输入第一行有一个整数0 2 int shu[9] = {1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; 3 int main() 4 { 5 int m, n, i; 6 scanf("%d", &m); 7 while(m--){ 8 9 scanf("%d", &n);10 i = 8;11 while(...
阅读全文
摘要:描述我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?输入输入一个整数m(0 3 #include 4 #define M 20000 5 int shu[M]; 6 7 int main() 8 { 9 int m, i, n, b, t, e;10 while(scanf("%d", &m) != EOF){11 12 memset(shu, 0, sizeof(shu));13 shu[0] = 1;14 n = 0;/*n表示存放进位*/15 for(i = 1; i ...
阅读全文
摘要:描述现在,有一行括号序列,请你检查这行括号是否配对。输入第一行输入一个数N(0#include #define M 10001char s[M], s1[M];//s是目标数组,s1是栈int main(){ int n, len, top, i; scanf("%d", &n); while(n--){ top = 3;//栈顶 scanf("%s", s+1); len = strlen(s+1); for(i = 1; i <= len; i++){ ...
阅读全文
摘要:Yet another end of the worldTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 0Accepted Submission(s): 0Problem DescriptionIn the year 3013, it has been 1000 years since the previous predicted rapture. However, the Maya will not play a joke any more
阅读全文
摘要:#include #include #define M 101int s[M][M];int main(){ int n, i, j, t; while(scanf("%d", &n) != EOF){ memset(s, 0, sizeof(s)); t = 1; s[i=1][j=n] = t++; while(t = 1 && !s[i][j-1]){ s[i][--j] = t++; } while(i-1...
阅读全文
摘要:蛇形矩阵是由1开始的自然数依次排列成的一个矩阵上三角形。Input本题有多组数据,每组数据由一个正整数N组成。(1#include int s[23][23];int main(){ int x, n, i, j, t; scanf("%d", &x); while(x--){ scanf("%d", &n); memset(s, 0, sizeof(s));//对于填数题一定记得清0,而且二维数组清0是在sizeof里写上数组名 i = j = t = 1; ...
阅读全文
摘要:Gardon的18岁生日就要到了,他当然很开心,可是他突然想到一个问题,是不是每个人从出生开始,到达18岁生日时所经过的天数都是一样的呢?似乎并不全都是这样,所以他想请你帮忙计算一下他和他的几个朋友从出生到达18岁生日所经过的总天数,让他好来比较一下。Input一个数T,后面T行每行有一个日期,格式是YYYY-MM-DD。如我的生日是1988-03-07。OutputT行,每行一个数,表示此人从出生到18岁生日所经过的天数。如果这个人没有18岁生日,就输出-1。Sample Input1 1988-03-07Sample Output6574 1 #include 2 3 int judg..
阅读全文
摘要:时间限制:1000 ms | 内存限制:65535 KB难度:5描述在漆黑的夜里,N位旅行者来到了一座狭窄而且没有护栏的桥边。如果不借助手电筒的话,大家是无论如何也不敢过桥去的。不幸的是,N个人一共只带了一只手电筒,而桥窄得只够让两个人同时过。如果各自单独过桥的话,N人所需要的时间已知;而如果两人同时过桥,所需要的时间就是走得比较慢的那个人单独行动时所需的时间。问题是,如何设计一个方案,让这N人尽快过桥。输入第一行是一个整数T(1#include #define M 1001int time[M];int cmp(const void *a, const void *b){ return...
阅读全文
摘要:总是wa~#include int main(){ int n, i, j, k, atop, cmd[20]; char a[10], b[10]; while(scanf("%d %s %s", &n, a, b) != EOF){ for(i = 0, j = 0, k = 0; i 0 && a[atop - 1] == b[j]){ cmd[k++] = 0; j++; ...
阅读全文
摘要:DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possible to establish only a surface track. Moreover, it turned out that the station could be only a d
阅读全文
摘要:DescriptionThe input contains N natural (i.e. positive integer) numbers ( N #define M 10001int a[M], mod[M];int main(){ int n, i, sum, begin, end; while(scanf("%d", &n) != EOF){ sum = 0; for(i = 1; i 0) ...
阅读全文
摘要:描述Dr.Kong设计的机器人卡多掌握了加减法运算以后,最近又学会了一些简单的函数求值,比如,它知道函数min(20,23)的值是20,add(10,98)的值是108等等。经过训练,Dr.Kong设计的机器人卡多甚至会计算一种嵌套的更复杂的表达式。假设表达式可以简单定义为:1.一个正的十进制数x是一个表达式。2.如果x和y是表达式,则函数min(x,y)也是表达式,其值为x,y中的最小数。3.如果x和y是表达式,则函数max(x,y)也是表达式,其值为x,y中的最大数。4.如果x和y是表达式,则函数add(x,y)也是表达式,其值为x,y之和。例如,表达式max(add(1,2),7)的值为
阅读全文
摘要:描述现在有很多长方形,每一个长方形都有一个编号,这个编号可以重复;还知道这个长方形的宽和长,编号、长、宽都是整数;现在要求按照一下方式排序(默认排序规则都是从小到大);1.按照编号从小到大排序2.对于编号相等的长方形,按照长方形的长排序;3.如果编号和长都相同,按照长方形的宽排序;4.如果编号、长、宽都相同,就只保留一个长方形用于排序,删除多余的长方形;最后排好序按照指定格式显示所有的长方形;输入第一行有一个整数 0#include #define M 1000struct info{ int list; int lenth; int wide;};struct info s...
阅读全文
摘要:输入n(n#include #include #define M 101//; 宏定义后不加;int cmp(const void *a, const void *b){ //return abs(*(int *a)) < abs(*(int *b)); // return abs(*(int *)a) < abs(*(int *)b);//(int *)是将原来的void *型强制转换 return abs(*(int *)b) - abs(*(int *)a);//写成这样就AC了! }int main(){ int n, i, ...
阅读全文
摘要:1 #include 2 #include 3 int m2 = 29; 4 int judge_year(int x) 5 { 6 7 if(x % 400 == 0 || x % 4 == 0 && x % 100 != 0) 8 return 1; 9 else 10 return 0; 11 12 } 13 14 //extern int m2; 15 int calculate_year(int *x, int y) 16 { 17 18 /...
阅读全文
摘要:DescriptionA calendar is a system for measuring time, from hours and minutes, to months and days, and finally to years and centuries. The terms of hour, day, month, year and century are all units of time measurements of a calender system. According to the Gregorian calendar, which is the civil calen
阅读全文

浙公网安备 33010602011771号