上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页
摘要: Descriptionn的阶乘定义为n!=1*2*3*……*n 如3!=6 n!通常最后会有很多0,如5!=120 最后有一个0,现在统计n!去除末尾的0后,最后k位是多少Input第一行包括两个数n,kOutput如果n!不止k位,则输出最后k位,如果不足k位,则高位补零,补足k位后输出 注意!这里与阶乘统计1有区别!Sample Input7 2Sample Output04HINT7!为5040,去除末尾的0为504,最后两位为04100%满足1< =n< =1400000 1< =k< =10#include<stdio.h>#include< 阅读全文
posted @ 2012-01-10 15:00 狸の舞 阅读(234) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>int main(){ int a, b, c; char ch1, ch2, ch3, d; scanf( "%d-%d-%d-%c", &a, &b, &c, &d); if( d == 'X' ) d = 10; else d -= '0'; int sum = 0; sum += a*1; sum += ( b / 100 )*2; sum += ( b / 10 % ... 阅读全文
posted @ 2011-12-24 20:14 狸の舞 阅读(264) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include<stdlib.h>int main(){ int M, T, U, F, D; int ans, i; char ch[2]; scanf("%d%d%d%d%d",&M,&T,&U,&F,&D); ans=0; for( ans=0;ans<=T;ans++) { scanf("%s",ch); if (ch[0]=='f') { M=M-2*F ; } if (ch[0]=='u')... 阅读全文
posted @ 2011-12-18 21:27 狸の舞 阅读(183) 评论(0) 推荐(0) 编辑
摘要: Description某校的惯例是在每学期的期末考试之后发放奖学金。发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖学金,每人8000元,期末平均成绩高于80分(> 80),并且在本学期内发表1篇或1篇以上论文的学生均可获得; 2) 五四奖学金,每人4000元,期末平均成绩高于85分(> 85),并且班级评议成绩高于80分(> 80)的学生均可获得; 3) 成绩优秀奖,每人2000元,期末平均成绩高于90分(> 90)的学生均可获得; 4) 西部奖学金,每人1000元,期末平均成绩高于85分(> 85)的西部省份学生均可获得; 5) 班级贡献奖,每人850 阅读全文
posted @ 2011-12-18 19:01 狸の舞 阅读(208) 评论(0) 推荐(0) 编辑
摘要: InputInput The first line of input is 8 positive numbers which indicate the coordinates of four points that must be on each diagonal.The 8 numbers are x1,y1,x2,y2,x3,y3,x4,y4.That means the two points on the first rectangle are(x1,y1),(x2,y2);the other two points on the second rectangle are (x3,y3), 阅读全文
posted @ 2011-12-16 13:38 狸の舞 阅读(246) 评论(0) 推荐(0) 编辑
摘要: DescriptionMany Normal students will be teachers after graduating, and as a head teacher, arranging the seats for students is a problem. Xuanflyer wants to arrange seats for his students, and he comes up with a strange idea. 1 4 5 16 2 3 6 15 9 8 7 14 10 11 12 13 He arranges the seats in a snake-sha 阅读全文
posted @ 2011-12-12 11:38 狸の舞 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 题目描述Alice and Bob are playing a game. Firstly, Bob writes several numbers on a chessboard, which is a n*m matrix. Then, it is Alice’s turn to operate. In Every operation, he is allowed to plus or minus a random number to the two adjoining squares. now, Alice wants to know whether there is an operati 阅读全文
posted @ 2011-12-11 21:40 狸の舞 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 主要思想在与:B - 'A' + 1 = 2 ; 'a' - b - 1 = -2;Problem Descriptionwe define f(A) = 1, f(a) = -1, f(B) = 2, f(b) = -2, ... f(Z) = 26, f(z) = -26;Give you a letter x and a number y , you should output the result of y+f(x).InputOn the first line, contains a number T.then T lines follow, each 阅读全文
posted @ 2011-12-10 19:53 狸の舞 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 首先我处理了前导的0; while( *p1 == '0' ) p1++; while( *p2 == '0' ) p2++;用了指针移动指向来实现的。然后处理了“.”号, 因为在小数中,一个小数点,后面什么也没有,可以。所以我讲小数点置为空。if( *p1 == '.' ) *p1 = 0;而且处理了后导0, 就使后面所以的0 都置为空,就相当于没有。最后比较就可以了~~Problem DescriptionGive you two numbers A and B, if A is equal to B, you should print &q 阅读全文
posted @ 2011-12-09 12:01 狸の舞 阅读(617) 评论(0) 推荐(0) 编辑
摘要: 杭电acm 2053 Switch Game2010-07-20 11:39Switch GameTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3425 Accepted Submission(s): 2007Problem DescriptionThere are many lamps in a line. All of them are off at first. A series of operations are carried o 阅读全文
posted @ 2011-11-28 22:24 狸の舞 阅读(357) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页