杭州电子科技大学ACM刷题
杭电acm题目水题英文题目、翻译及ac源代码
1040 As Easy As A+BTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 26015 Accepted Submission(s): 11054Problem DescriptionThese days, I am thinking about a question, how can I get a problem as easy as A+B? It is fairly difficulty to do such a thing. Of course, I got it after many waking nights.Give you some integers, your task is to sort these number ascending (升序).You should know how easy the problem is now!Good luck!InputInput contains multiple test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow. Each test case contains an integer N (1<=N<=1000 the number of integers to be sorted) and then N integers follow in the same line.It is guarantied that all integers are in the range of 32-int.OutputFor each case, print the sorting result, and one line one case.问题描述这些天来,我在思考一个问题,我怎样才能得到一个简单的问题,因为A + B?这是相当困难做这样的事情。
(完整版)杭电acm部分答案
Problem DescriptionCalculate A + B.InputEach line will contain two integers A and B. Process to end of file.OutputFor each case, output A + B in one line.Sample Input1 1Sample Output2#include<stdio.h>void main(){int a,b;while(scanf("%d %d",&a,&b)!=EOF){printf("%d\n",a+b);}}Problem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.Sample Input1100Sample Output15050#include<stdio.h>void main(){int n,sum,i;while(scanf("%d",&n)!=EOF){sum=0;for( i=0;i<=n;i++)sum+=i;printf("%d\n\n",sum);}}Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line consists of two positive integers, A and B. Notice that the integers are very large, that means you should not process them by using 32-bit integer. You may assume the length of each integer will not exceed 1000.OutputFor each test case, you should output two lines. The first line is "Case #:", # means the number of the test case. The second line is the an equation "A + B = Sum", Sum means the result of A + B. Note there are some spaces int the equation. Output a blank line between two test cases.Sample Input21 2112233445566778899 998877665544332211Sample OutputCase 1:1 +2 = 3Case 2:112233445566778899 + 998877665544332211 = 1111111111111111110 #include<stdio.h>#include<string.h>int main(){char str1[1001], str2[1001];int t, i, len_str1, len_str2, len_max, num = 1, k;scanf("%d", &t);getchar();while(t--){int a[1001] = {0}, b[1001] = {0}, c[1001] = {0};scanf("%s", str1);len_str1 = strlen(str1);for(i = 0; i <= len_str1 - 1; ++i)a[i] = str1[len_str1 - 1 - i] - '0';scanf("%s",str2);len_str2 = strlen(str2);for(i = 0; i <= len_str2 - 1; ++i)b[i] = str2[len_str2 - 1 - i] - '0';if(len_str1 > len_str2)len_max = len_str1;elselen_max = len_str2;k = 0;for(i = 0; i <= len_max - 1; ++i){c[i] = (a[i] + b[i] + k) % 10;k = (a[i] + b[i] + k) / 10;}if(k != 0)c[len_max] = 1;printf("Case %d:\n", num);num++;printf("%s + %s = ", str1, str2);if(c[len_max] == 1)printf("1");for(i = len_max - 1; i >= 0; --i){printf("%d", c[i]);}printf("\n");if(t >= 1)printf("\n");}return 0;}Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line starts with a number N(1<=N<=100000), then N integers followed(all the integers are between -1000 and 1000).OutputFor each test case, you should output two lines. The first line is "Case #:", # means the number of the test case. The second line contains three integers, the Max Sum in the sequence, the start position of the sub-sequence, the end position of the sub-sequence. If there are more than one result, output the first one. Output a blank line between two cases.Sample Input25 6 -1 5 4 -77 0 6 -1 1 -6 7 -5Sample OutputCase 1:14 1 4Case 2:7 1 6注:最大子序列是要找出由数组成的一维数组中和最大的连续子序列。
杭电acm部分题目及答案答案
自己刷的题这是我在杭电做题的记录,希望我的分享对你有帮助!!!1001 Sum Problem***********************************************************1 1089 A+B for Input-Output Practice (I)********************************21090 A+B for Input-Output Practice (II)********************************51091A+B for Input-Output Practice (III)****************************************7 1092A+B for Input-Output Practice (IV)********************************81093 A+B for Input-Output Practice (V)********************************101094 A+B for Input-Output Practice (VI)***************************************12 1095A+B for Input-Output Practice (VII)*******************************131096 A+B for Input-Output Practice (VIII)******************************15How to Type***************************************************************161001 Sum ProblemProblem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.Sample Input1100Sample Output15050AuthorDOOM III解答:#include<stdio.h>main(){int n,i,sum;sum=0;while((scanf("%d",&n)!=-1)){sum=0;for(i=0;i<=n;i++)sum+=i;printf("%d\n\n",sum);}}1089 A+B for Input-Output Practice(I)Problem DescriptionYour task is to Calculate a + b.Too easy?! Of course! I specially designed the problem for acm beginners.You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim.InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.Sample Input1 510 20Sample Output630AuthorlcyRecommendJGShining解答:#include<stdio.h>main(){int a,b;while(scanf("%d%d",&a,&b)!=EOF)printf("%d\n",a+b);}1090 A+B for Input-Output Practice(II)Problem DescriptionYour task is to Calculate a + b.InputInput contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.Sample Input21 510 20Sample Output630AuthorlcyRecommendJGShining解答:#include<stdio.h>#define M 1000void main(){int a ,b,n,j[M],i;//printf("please input n:\n"); scanf("%d",&n);for(i=0;i<n;i++){scanf("%d%d",&a,&b);//printf("%d %d",a,b);j[i]=a+b;}i=0;while(i<n){printf("%d",j[i]);i++;printf("\n");}}1091A+B for Input-Output Practice(III)Problem DescriptionYour task is to Calculate a + b.InputInput contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.Sample Input1 510 200 0Sample Output630AuthorlcyRecommendJGShining解答:#include<stdio.h>main(){int a,b;scanf("%d %d",&a,&b);while(!(a==0&&b==0)){printf("%d\n",a+b);scanf("%d %d",&a,&b);}}1092A+B for Input-Output Practice(IV)Problem DescriptionYour task is to Calculate the sum of some integers.InputInput contains multiple test cases. Each test case contains a integer N, and then N integers followin the same line. A test case starting with 0 terminates the input and this test case is not to be processed.OutputFor each group of input integers you should output their sum in one line, and with one line of output for each line in input.Sample Input4 1 2 3 45 1 2 3 4 5Sample Output1015AuthorlcyRecommendJGShining解答:#include <stdio.h>int main(){int n,sum,i,t;while(scanf("%d",&n)!=EOF&&n!=0) {sum=0;for(i=0;i<n;i++){scanf("%d",&t);sum=sum+t;}printf("%d\n",sum);}}1093 A+B for Input-Output Practice(V)Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.OutputFor each group of input integers you should output their sum in one line, and with one line of output for each line in input.Sample Input24 1 2 3 45 1 2 3 4 5Sample Output1015Authorlcy解答:#include<stdio.h>main(){int n,a,b,i,j,sum;sum=0;while(scanf("%d\n",&n)!=-1) {for(i=0;i<n;i++){scanf("%d",&b);for(j=0;j<b;j++){scanf("%d",&a);sum+=a;}printf("%d\n",sum); sum=0;}}}1094 A+B for Input-Output Practice (VI) Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line.OutputFor each test case you should output the sum of N integers in one line, and with one line of output for each line in input.Sample Input4 1 2 3 45 1 2 3 4 5Sample Output1015AuthorlcyRecommendJGShining解答:#include<stdio.h>main(){int n,a,b,i,j,sum;sum=0;while(scanf("%d\n",&n)!=-1){for(j=0;j<n;j++){scanf("%d",&a);sum+=a;}printf("%d\n",sum);sum=0;}}[ Copy to Clipboard ][ Save to File]1095A+B for Input-Output Practice (VII) Problem DescriptionYour task is to Calculate a + b.InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. OutputFor each pair of input integers a and b you should output the sum of a and b, and followed by a blank line.Sample Input1 510 20Sample Output630AuthorlcyRecommendJGShining解答:#include<stdio.h>main(){int a,b;while(scanf("%d%d",&a,&b)!=EOF)printf("%d\n\n",a+b);}1096 A+B for Input-Output Practice (VIII) Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.OutputFor each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.Sample Input34 1 2 3 45 1 2 3 4 53 1 2 3Sample Output10156AuthorlcyRecommendJGShining解答:int main(){int a,b,i,j,l[1000],k;scanf("%d",&i);getchar();for(j=1;j<=i;j++)l[j]=0;for(j=1;j<=i;j++){scanf("%d",&a);getchar();for(k=1;k<=a;k++){scanf("%d",&b);getchar();l[j]+=b;}}for(j=1;j<=i-1;j++)printf("%d\n\n",l[j]);printf("%d\n",l[i]);}How to TypeProblem DescriptionPirates have finished developing the typing software. He called Cathy to test his typing software. She is good at thinking. After testing for several days, she finds that if she types a string by some ways, she will type the key at least. But she has a bad habit that if the caps lock is on, she must turn off it, after she finishes typing. Now she wants to know the smallest times of typing the key to finish typing a string.InputThe first line is an integer t (t<=100), which is the number of test case in the input file. For each test case, there is only one string which consists of lowercase letter and upper case letter. The length of the string is at most 100.OutputFor each test case, you must output the smallest times of typing the key to finish typing this string.Sample Input 3Pirates HDUacm HDUACM Sample Output 888#include <stdio.h>#include <string.h>#define MAX 200int arr[MAX][4];char str[MAX];int letter(char ch){if(ch>='A'&&ch<='Z') return 1;return 0;}void proc(){int i;int tmp,min;int len=strlen(str);for(i=0;i<len;i++){if(i==0){if(letter(str[i])) { arr[i][1]=2; arr[i][2]=2; }else { arr[i][0]=1; arr[i][3]=3; }}else{if(letter(str[i])==letter(str[i-1])){if(arr[i-1][0]){ arr[i][0]=arr[i-1][0]+1;arr[i][3]=arr[i-1][0]+3;}if(arr[i-1][1]) { arr[i][1]=arr[i-1][1]+2; arr[i][2]=arr[i-1][1]+2;}if(arr[i-1][2]){if(arr[i][0]>arr[i-1][2]+1||!arr[i][0]) arr[i][0]=arr[i-1][2]+1;if(arr[i][3]>arr[i-1][2]+3||!arr[i][3]) arr[i][3]=arr[i-1][2]+3;}if(arr[i-1][3]){if(arr[i][1]>arr[i-1][3]+2||!arr[i][1]) arr[i][1]=arr[i-1][3]+2;if(arr[i][2]>arr[i-1][3]+2||!arr[i][2]) arr[i][2]=arr[i-1][3]+2;}}else{if(arr[i-1][0]){ arr[i][1]=arr[i-1][0]+2; arr[i][2]=arr[i-1][0]+2;}if(arr[i-1][1]){ arr[i][0]=arr[i-1][1]+1; arr[i][3]=arr[i-1][1]+3;}if(arr[i-1][2]){if(arr[i][1]>arr[i-1][2]+2||!arr[i][1]) arr[i][1]=arr[i-1][2]+2;if(arr[i][2]>arr[i-1][2]+2||!arr[i][2]) arr[i][2]=arr[i-1][2]+2;}if(arr[i-1][3]){if(arr[i][0]>arr[i-1][3]+1||!arr[i][0]) arr[i][0]=arr[i-1][3]+1;if(arr[i][3]>arr[i-1][3]+3||!arr[i][3]) arr[i][3]=arr[i-1][3]+3;}}}}min=3*MAX;if(letter(str[len-1])){if(arr[len-1][0]){ tmp=arr[len-1][0]+1; if(tmp<min) min=tmp;}if(arr[len-1][1]){ tmp=arr[len-1][1]; if(tmp<min) min=tmp; }if(arr[len-1][2]){ tmp=arr[len-1][2]+1; if(tmp<min) min=tmp;}if(arr[len-1][3]){ tmp=arr[len-1][3]; if(tmp<min) min=tmp; } }else{if(arr[len-1][0]) { tmp=arr[len-1][0]; if(tmp<min) min=tmp; }if(arr[len-1][1]) { tmp=arr[len-1][1]+1; if(tmp<min) min=tmp;}if(arr[len-1][2]) { tmp=arr[len-1][2]; if(tmp<min) min=tmp; }if(arr[len-1][3]) { tmp=arr[len-1][3]+1; if(tmp<min) min=tmp;} }printf("%d\n",min);}//Caps Shift:0-00;1-01;2-10;3-11int main(){int num;scanf("%d",&num);while(num--){scanf("%s",str);memset(arr,0,strlen(str)*4*sizeof(int));proc();}return 0;}。
杭电acm练习题100例(删减版)
杭电acm练习题100例(删减版)【程序1】题目:有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少?1.程序分析:可填在百位、十位、个位的数字都是1、2、3、4。
组成所有的排列后再去掉不满足条件的排列。
#include "stdio.h"#include "conio.h"main(){ int i,j,k;printf("\n");for(i=1;i<5;i++) /*以下为三重循环*/for(j=1;j<5;j++)for (k=1;k<5;k++){ if (i!=k&&i!=j&&j!=k) /*确保i、j、k三位互不相同*/printf("%d,%d,%d\n",i,j,k); }getch(); }==============================================================【程序2】题目:企业发放的奖金根据利润提成。
利润(I)低于或等于10万元时,奖金可提10%;利润高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可可提成7.5%;20万到40万之间时,高于20万元的部分,可提成5%;40万到60万之间时高于40万元的部分,可提成3%;60万到100万之间时,高于60万元的部分,可提成1.5%,高于100万元时,超过100万元的部分按1%提成,从键盘输入当月利润I,求应发放奖金总数?#include "stdio.h" #include "conio.h"main(){ long int i;int bonus1,bonus2,bonus4,bonus6,bonus10,bonus;scanf("%ld",&i);bonus1=100000*0. 1;bonus2=bonus1+100000*0.75;bonus4=bonus2+200000*0.5;bonus6=bonus4+200000*0.3;bonus10=bonus6+400000*0.15;if(i<=100000)bonus=i*0.1;else if(i<=200000)bonus=bonus1+(i-100000)*0.075;else if(i<=400000)bonus=bonus2+(i-200000)*0.05;else if(i<=600000)bonus=bonus4+(i-400000)*0.03;else if(i<=1000000)bonus=bonus6+(i-600000)*0.015;elsebonus=bonus10+(i-1000000)*0.01;printf("bonus=%d",bonus);getch(); }====================================== ========================【程序3】题目:一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?#include "math.h"#include "stdio.h"#include "conio.h"main(){ long int i,x,y,z;for (i=1;i<100000;i++){ x=sqrt(i+100); /*x为加上100后开方后的结果*/y=sqrt(i+268); /*y为再加上168后开方后的结果*/if(x*x==i+100&&y*y==i+268)printf("\n%ld\n",i); }getch(); }====================================== ========================【程序4】题目:输入某年某月某日,判断这一天是这一年的第几天?#include "stdio.h" #include "conio.h"main(){ int day,month,year,sum,leap;printf("\nplease input year,month,day\n");scanf("%d,%d,%d",&year,&month,&day);switch(month) /*先计算某月以前月份的总天数*/{ case 1:sum=0;break;case 2:sum=31;break;case 3:sum=59;break;case 4:sum=90;break;case 5:sum=120;break;case 6:sum=151;break;case 7:sum=181;break;case 8:sum=212;break;case 9:sum=243;break;case 10:sum=273;break;case 11:sum=304;break;case 12:sum=334;break;default:printf("data error");break; }sum=sum+day; /*再加上某天的天数*/if(year%400==0||(year%4==0&&year%100!=0)) /*判断是不是闰年*/leap=1;elseleap=0;if(leap==1&&month>2) /*如果是闰年且月份大于2,总天数应该加一天*/sum++;printf("It is the %dth day.",sum);getch(); }====================================== ======================== 【程序5】题目:输入三个整数x,y,z,请把这三个数由小到大输出。
杭州电子科技大学acm习题集锦
目录1、数塔问题 (2)2、并查集类问题 (4)3、递推类问题 (9)4、动态规划系列 (10)5、概率类题型 (13)6、组合数学类题型 (15)7、贪心策略 (16)8、几何问题 (19)数塔类问题数塔Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,它是这样描述的:有如下所示的数塔,要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?已经告诉你了,这是个DP的题目,你能AC吗?Input输入数据首先包括一个整数C,表示测试实例的个数,每个测试实例的第一行是一个整数N(1 <= N <= 100),表示数塔的高度,接下来用N行数字表示数塔,其中第i行有个i个整数,且所有的整数均在区间[0,99]内。
Output对于每个测试实例,输出可能得到的最大和,每个实例的输出占一行。
Sample Input1573 88 1 02 7 4 44 5 2 6 5Sample Output 30#include<stdio.h>#include<string.h>#define MAX 101int arr[MAX][MAX][2];void res(){int n; int i,j;memset(arr,0,MAX*MAX*sizeof(int));scanf("%d",&n);for(i=0;i<n;i++) //输入数塔for(j=0;j<=i;j++) { scanf("%d",&arr[i][j][0]); arr[i][j][1]=arr[i][j][0]; }for(i=n-2;i>=0;i--){for(j=0;j<=i;j++){if(arr[i+1][j][1]>arr[i+1][j+1][1]) arr[i][j][1]+=arr[i+1][j][1];else arr[i][j][1]+=arr[i+1][j+1][1];}}printf("%d\n",arr[0][0][1]);}int main(){int num;scanf("%d",&num);while(num--) { res(); }return 0;}免费馅饼Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。
杭电ACM试题详细分类,杭电oj详细分类,hdu详细分类,详细,ACM.doc
杭电ACM试题分类枚举1002 10041013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 10391042 10471048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 10841088 11061107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 117711971200 1201 1202 1205 1209 1212(大数取模)1216 (链表)1218 1219 12251228 12291230 1234 1235 1236 1237 1239 1250 1256 1259 1262 1263 1265 12661276 1279 1282 1283 1287 1296 1302 1303 1304 1305 1306 1309 1311 1314搜索,递归求解1010 1016 1026 1043(双广)1044 (BFS+DFS) 1045 1067 1072 1104 1175 1180 11951208 1226 1238 1240 1241 1242 1258 1271 1312 1317动态规划1003 1024 1025 1028 1051 1058 1059 1069 1074 1078 1080 1081 1085 1087 1114 1158 1159 1160 1171 1176 1181 1203 1224 1227 1231 1244 1248 1253 1254 1283 1300数学,递推,规律1005 1006 1012 1014 1018 1019 1021 1023 1027 1030 1032 1038 1041 1046 1059 1060 1061 1065 1066 1071(微积分)1097 1098 1099 1100 1108 1110 1112 1124 1130 1131 1132 1134 1141 1143 1152 1155(物理题)1163 1165 1178 1194 1196(lowbit) 1210 1214 1200 1221 1223 1249 1261 1267 1273 1290 1291 1292 1294 1297 1313 1316数论1164 1211 1215 1222 1286 1299计算几何1086 1115 1147贪心1009 1052 1055 1257 并查集11981213 1232 1272线段树,离散化11991255图论最短路相关的问题1142 1162 1217 1301二分图问题1054 1068 1150 1151 1281其他1053 (huffman) 1102(MST) 1116 (欧拉回路)1233(MST) 1269 (强连通)数据结构1103 (堆+模拟)1166 (数状树组)1247 1251 1285 (Topol) 1298以下是详细介绍1002简单的大数1003 DP经典问题,最大连续子段和1004简单题1005找规律(循环点)1007经典问题,最近点对问题,用分治1008简单题1010搜索题,剪枝很关1009贪心1012简单题1013简单题(有个小陷阱)1014简单题1015可以看作搜索题吧1016经典的搜索1017简单数学题1018简单数学题1019简单数学题1020简单的字符串处理找规律的数学题数据结构的题(栈的应用)特殊的数(Catalan Number)经典DP,最大M 子段和经典DP,最长递增子序列(要用NLogN的方法过)搜索数学题(或用STL)经典问题,整数拆分,用母函数做简单题(一般方法容易超时)简单题,可用模拟过简单题简单题模拟题Candy Sharing Game模拟题简单题简单题,不是一般的简单简单题字符串处理简单题,排序简单题,用大数大数经典搜索题,八数码问题稍微有点麻烦的搜索题搜索题,可用匹配做简单题简单的大数简单字符串处理简单题贪心经典贪心,也可以用DP贪心贪心,关于Huffman编码二分匹配二分匹配简单题模拟题经典问题,丑数,DP经典问题,可以用母函数或DP (不针对题目优化都会超时)数学题数学题简单字符串处理模拟大数简单题1065简单题1066数学题,找规律1068经典二分匹配1069经典DP1070简单题1071简单数学题1072搜索1073字符串处理1074 DP1075字典树1076简单题1078DP1079博弈(DP)1080DP 1081经典DP1082简单题1083二分匹配1084简单题1085母函数1086简单几何题1087简单DP1088字符串处理1089~1096 (练习输入输出的8个题目)1097简单数学题1098数学题,注意找规律1099数学HrH1500DP1501DP1502DP or记忆化1503DP1504模拟1505DP1506DP15072分匹配1508记忆化容易点1509模拟1510 DP1511搜索可以过1512左偏树1513DP1514DP1515DFS1516DP1517博奕搜索DP (不确定)树状DP 数学题稳定婚姻DP 博弈博弈Maxflow博弈2分匹配简单题最大团差分约束Maxflow入门题KM Or > 小费用流差分约束差分约束博弈模拟加置换群的理论CODE可以短些,其实没必要。
杭电题目acm答案
1001 Sum Problem ............................................. 错误!未定义书签。
1089 A+B for Input-Output Practice (I) ...................... 错误!未定义书签。
1090 A+B for Input-Output Practice (II) ..................... 错误!未定义书签。
1091 A+B for Input-Output Practice (III) .................... 错误!未定义书签。
1092 A+B for Input-Output Practice (IV) ...................... 错误!未定义书签。
1093 A+B for Input-Output Practice (V) ...................... 错误!未定义书签。
1094 A+B for Input-Output Practice (VI) ..................... 错误!未定义书签。
1095 A+B for Input-Output Practice (VII) ..................... 错误!未定义书签。
1096 A+B for Input-Output Practice (VIII) ................... 错误!未定义书签。
2000 ASCII码排序............................................ 错误!未定义书签。
2001计算两点间的距离........................................ 错误!未定义书签。
2002计算球体积.............................................. 错误!未定义书签。
ACM刷题指南
1. 12月下旬将举行新生赛。
新生赛有企业赞助,有奖金、t恤、礼品。
参加ACM 新生赛是一个锻炼自己、检验自己的好机会。
2. 加入新生群235783335,不打算参加ACM也建议加入,里面有ACM高年级同学,有问题可以交流,这样有助于学习C++.3. 在题库成功解决100题的同学可发邮件申请老带新。
将面试确认是否抄袭。
邮箱:holgst@,附上账号、姓名、班级。
==============================================================ACM题库地址: http://210.38.224.114点击网页下方“中文”选择语言。
本指南分以下四部分内容:一、注册账号二、提交代码三、结果信息解释四、题目分类(前100题)一、注册账号图1 注册账号二、提交代码1.点击网页右上角“登陆”,填写用户名密码登陆。
2.点击“问题”进入题目列表,点击题目名称查看题目,如图2所示。
图2 查看题目3.提交代码阅读题目后,可在开发环境下编写、测试代码。
编写好代码后点击题目下方的“提交”链接,如图3所示。
图3 提交代码下面以第1000题为例演示代码提交过程。
(1) 选择语言C++;(2) 输入代码(可从开发环境下拷贝代码粘贴到此处);(3) 点击submit提交代码。
如图4所示。
提交代码后页面转到状态列表,留意结果信息。
图5 结果列表三、结果信息解释1.Accept,程序正确。
2.Wrong Answer,程序有误,常见错误原因有:(1) 程序解法错。
(2) 解法正确,但没考虑周全,对于一些特殊数据输入,程序未能输出正确解。
例如第1013题,需要考虑a、b、c相等的情况。
(3) 程序有多余的输出提示。
例如程序中出现cout << "请输入两个整数”;这种语句。
需要严格按照题目的“输出”描述输出数据(即,若没要求输出提示信息,则不要输出)。
3.Presentation Error,程序输出答案正确,但格式错误。
杭电ACM博弈题合集
杭电ACM博弈题合集hdu博弈,这些题都不难。
属于博弈简单题。
hdu1846巴什博弈,n%(m+1)==0先手必败。
#include#include#include#include#includeusing namespace std;int main(){int n,a,b;scanf("%d",&n);while(n--){scanf("%d%d",&a,&b);if(a%(b+1)==0)printf("second\n");else printf("first\n");}return 0;}hdu1847只要留下两类都是2的指数幂,就是必输状态,然后找规律,发现这两类的和为3的倍数。
即有下面的结论。
#include#include#includeusing namespace std;int main(){int n;while(scanf("%d",&n)!=EOF) {if(n%3==0)printf("Cici\n");else printf("Kiki\n");}return 0;}hdu1848#include#include#include#includeusing namespace std;#define N 1005int f[N];int sg[N];void fun(){int i;f[0]=1;f[1]=1;f[2]=2;for(i=3;;i++){f[i]=f[i-1]+f[i-2];if(f[i]>1000)break;}}int dfs(int v){int i;if(sg[v]!=-1)return sg[v];bool visit[N]={0};for(i=1;i<16;i++){if(v>=f[i]){int temp=dfs(v-f[i]);visit[temp]=1;}}for(i=0;visit[i];i++);return sg[v]=i;}int main(){fun();int m,n,p;while(scanf("%d%d%d",&m,&n,&p),m||n||p) { memset(sg,-1,sizeof(sg));int ans;ans=dfs(m)^dfs(n)^dfs(p);if(ans)printf("Fibo\n");else printf("Nacci\n");}return 0;}hdu1849裸的NIM博弈,直接异或即可。
杭电OJ:1089----1096(c++)(ACM入门第一步:所有的输入输出格式)
杭电OJ:1089----1096(c++)(ACM⼊门第⼀步:所有的输⼊输出格式)1089:输⼊输出练习的A + B(I)问题描述您的任务是计算a + b。
太容易了?!当然!我专门为ACM初学者设计了这个问题。
您⼀定已经发现某些问题与此标题具有相同的名称,是的,所有这些问题都是出于相同的⽬的⽽设计的。
输⼊项输⼊将由⼀系列由空格隔开的整数对a和b组成,每⾏⼀对整数。
输出量对于每对输⼊整数a和b,应该在⼀⾏中输出a和b的总和,并且在输⼊中每⾏输出⼀⾏。
样本输⼊1 5 10 20样本输出6 30题解:#include<cstdio>#include<iostream>using namespace std;int main(){int a, b,sum;while(cin >> a >> b){sum = a+b;cout << sum << endl;}return 0;}1090:投⼊产出练习的A + B(II)问题描述您的任务是计算a + b。
输⼊项输⼊的第⼀⾏包含⼀个整数N,然后是N⾏。
每⾏由⼀对整数a和b组成,每对之间⽤空格隔开,每⾏⼀对整数。
输出量对于每对输⼊整数a和b,应该在⼀⾏中输出a和b的总和,并且在输⼊中每⾏输出⼀⾏。
样本输⼊2 1 5 10 20样本输出6 30题解:#include<cstdio>#include<iostream>using namespace std;int a,b,n,sum;cin >> n;while (n){cin >> a >> b;sum = a + b;cout << sum << endl;n--;}return 0;}1091:投⼊产出练习的A + B(III)问题描述您的任务是计算a + b。
杭电 ACM steps 2.2.6解题报告
杭电ACM Steps 2.2.6解题报告#include<iostream>using namespace std;int a[101][101]={0};int main(){int n,i,j,len,r,temp,t;int b[101];a[1][0] = 1;len = 1;b[1] = 1;for(i=2;i<=100;i++){t = i-1;for(j=0;j<len;j++)a[i][j] = a[i-1][j]*(4*t+2);for(r=j=0;j<len;j++){temp = a[i][j] + r;a[i][j] = temp % 10;r = temp / 10;}while(r){a[i][len++] = r % 10;r /= 10;}for(j=len-1,r=0;j>=0;j--){temp = r*10 + a[i][j];a[i][j] = temp/(t+2);r = temp%(t+2);}while(!a[i][len-1])len --;b[i] = len;}while(cin>>n){for(j=b[n]-1;j>=0;j--)printf("%d",a[n][j]);printf("\n");}return 0;}这是一个火车问题,此题我们可以理解为栈的问题,n个数的进栈顺序已定,求出栈的顺序有多少种?我们不难知道n为1时,种数为1.当n为2是我们就可以以1来判断2的顺序,显然2可以放在第一位也可放在第二位。
当n为3时,如果2在第一位,那么3可插在1,2,3三个位置,如放在第二位,3可插在2,3两个位置。
所以种数为5种。
依次类推,我们可以计算n时的种数。
完整word版杭电ACM试题答案
【杭电ACM1000】A +B ProblemProblem DescriptionCalculate A + B.InputEach line will contain two integers A and B. Process to end of file.OutputFor each case, output A + B in one line.Sample Input1 1Sample Output2# include <stdio.h>int main(){int a, b;while(scanf(%d%d, &a, &b)!=EOF)printf(%d\n, a+b);return 0;}【杭电ACM1001】Sum ProblemProblem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge). In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.Sample Input1 100Sample Output1 5050# include <stdio.h>int main(){int n, i, sum = 0;while(scanf(%d, &n)!=EOF){for(i=1; i<=n; ++i)sum = sum + i;printf(%d\n\n, sum);sum = 0;}return 0;}【杭电ACM1002】A +B Problem IIProblem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line consists of two positive integers, A and B. Notice that the integersare very large, that means you should not process them by using 32-bit integer. You may assumethe length of each integer will not exceed 1000.OutputFor each test case, you should output two lines. The first line is Case #:, # means the number ofthe test case. The second line is the an equation A + B = Sum, Sum means the result of A + B.Note there are some spaces int the equation. Output a blank line between two test cases.Sample Input2 1 2 112233445566778899 998877665544332211Sample OutputCase 1: 1 + 2 = 3 Case 2: 112233445566778899 + 998877665544332211 = 1111111111111111110#include<stdio.h>#include<string.h>int shu(char a){return (a-'0');}int main(){char a[1000],b[1000];int num[1001];int n,i,j=1,al,bl,k,t;scanf(%d,&n);while(n--){getchar();if(j!=1)printf(\);scanf(%s,a);al=strlen(a);scanf(%s,b);bl=strlen(b);k=(al>bl)?al:bl;for(i=0;i<=k;i++)num[i]=0;t=k;for(k;al>0&&bl>0;k--){num[k]+=shu(a[--al])+shu(b[--bl]);if(num[k]/10){num[k-1]++;num[k]%=10;}}while(al>0){num[k--]+=shu(a[--al]);if(num[k+1]/10){num[k]++;num[k+1]%=10;}}while(bl>0){num[k--]+=shu(b[--bl]);if(num[k+1]/10){num[k]++;num[k+1]%=10;}}printf(Case %d:\n,j++);printf(%s + %s = ,a,b);for(i=0;i<=t;i++){if(i==0&&num[i]==0)i++;printf(%d,num[i]);}printf(\);}return 0;}。
杭州电子科技大学acm答案
else s1+=i*i*i; } cout<<s2<<" "<<s1<<endl; } return 0;
} 题解:输入的两个区间 大小不一定
2008 数值统计
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20378 Accepted Submission(s): 10783
正确代码:
#include<iostream> #include<cmath> #include<iomanip> #define PI 3.1415927 using namespace std; int main() {
double r,v; while(cin>>r) { v=4*PI*r*r*r/3;
Problem Description
统计给定的 n 个数中,负数、零和正数的个数。
Input
输入数据有多组,每组占一行,每行的第一个数是整数 n(n<100),表示需要统计的数值的个数,然 后是 n 个实数;如果 n=0,则表示输入结束,该行不做处理。
Output
对于每组输入数据,输出一行 a,b 和 c,分别表示给定的数据中负数、零和正数的个数。
Sample Input
6 0 1 2 3 -1 0 5 1 2 3 4 0.5 0
(完整word版)杭电ACM试题答案
【杭电ACM1000】A +B ProblemProblem DescriptionCalculate A + B.InputEach line will contain two integers A and B. Process to end of file.OutputFor each case, output A + B in one line.Sample Input1 1Sample Output2# include <stdio.h>int main(){int a, b;while(scanf("%d%d", &a, &b)!=EOF)printf("%d\n", a+b);return 0;}【杭电ACM1001】Sum ProblemProblem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge). In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.Sample Input1 100Sample Output1 5050# include <stdio.h>int main(){int n, i, sum = 0;while(scanf("%d", &n)!=EOF){for(i=1; i<=n; ++i)sum = sum + i;printf("%d\n\n", sum);sum = 0;}return 0;}【杭电ACM1002】A +B Problem IIProblem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line consists of two positive integers, A and B. Notice that the integers are very large, that means you should not process them by using 32-bit integer. You may assume the length of each integer will not exceed 1000.OutputFor each test case, you should output two lines. The first line is "Case #:", # means the number of the test case. The second line is the an equation "A + B = Sum", Sum means the result of A + B. Note there are some spaces int the equation. Output a blank line between two test cases.Sample Input2 1 2 112233445566778899 998877665544332211Sample OutputCase 1: 1 + 2 = 3 Case 2: 112233445566778899 + 998877665544332211 = 1111111111111111110#include<stdio.h>#include<string.h>int shu(char a){return (a-'0');}int main(){char a[1000],b[1000];int num[1001];int n,i,j=1,al,bl,k,t;scanf("%d",&n);while(n--){getchar();if(j!=1)printf("\n");scanf("%s",a);al=strlen(a);scanf("%s",b);bl=strlen(b);k=(al>bl)?al:bl;for(i=0;i<=k;i++)num[i]=0;t=k;for(k;al>0&&bl>0;k--){num[k]+=shu(a[--al])+shu(b[--bl]);if(num[k]/10){num[k-1]++;num[k]%=10;}}while(al>0){num[k--]+=shu(a[--al]);if(num[k+1]/10){num[k]++;num[k+1]%=10;}}while(bl>0){num[k--]+=shu(b[--bl]);if(num[k+1]/10){num[k]++;num[k+1]%=10;}}printf("Case %d:\n",j++);printf("%s + %s = ",a,b);for(i=0;i<=t;i++){if(i==0&&num[i]==0)i++;printf("%d",num[i]);}printf("\n");}return 0;}。
杭电题目acm答案
选修课考试作业1001 Sum Problem (2)1089 A+B for Input-Output Practice (I) (4)1090 A+B for Input-Output Practice (II) (6)1091 A+B for Input-Output Practice (III) (8)1092 A+B for Input-Output Practice (IV) (9)1093 A+B for Input-Output Practice (V) (11)1094 A+B for Input-Output Practice (VI) (13)1095 A+B for Input-Output Practice (VII) (14)1096 A+B for Input-Output Practice (VIII) (16)2000 ASCII码排序 (17)2001计算两点间的距离 (19)2002计算球体积 (21)2003求绝对值 (22)2004成绩转换 (23)2005第几天? (25)2006求奇数的乘积 (27)2007平方和与立方和 (29)2008数值统计 (30)2009求数列的和 (32)2010水仙花数 (33)2011多项式求和 (35)2012素数判定 (37)2014青年歌手大奖赛_评委会打分 (38)2015偶数求和 (40)2016数据的交换输出 (43)2017字符串统计 (45)2019数列有序! (46)2020绝对值排序 (48)2021发工资咯:) (50)2033人见人爱A+B (52)2039三角形 (54)2040亲和数 (55)姓名:郑春杰班级:电商1001学号:10105041341001 Sum ProblemProblem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.?InputThe input will consist of a series of integers n, one integer per line.?OutputFor each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.?Sample Input1100?Sample Output15050?AuthorDOOM III解答:#include<stdio.h>main(){int n,i,sum;sum=0;while((scanf("%d",&n)!=-1)){sum=0;for(i=0;i<=n;i++)sum+=i;printf("%d\n\n",sum);}}1089 A+B for Input-Output Practice (I)Problem DescriptionYour task is to Calculate a + b.Too easy?! Of course! I specially designed the problem for acm beginners.You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim.?InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.?OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.?Sample Input1 510 20?Sample Output630?Authorlcy?RecommendJGShining解答:#include<stdio.h>main(){int a,b;while(scanf("%d%d",&a,&b)!=EOF) printf("%d\n",a+b);}1090 A+B for Input-Output Practice (II)Problem DescriptionYour task is to Calculate a + b.?InputInput contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.?OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.?Sample Input21 510 20?Sample Output630?Authorlcy?RecommendJGShining解答:#include<stdio.h>#define M 1000void main(){int a,b,n,j[M],i;//printf("please input n:\n");scanf("%d",&n);for(i=0;i<n;i++){scanf("%d%d",&a,&b);//printf("%d %d",a,b);j[i]=a+b;}i=0;while(i<n){printf("%d",j[i]);i++;printf("\n");}}1091A+B for Input-Output Practice (III)Problem DescriptionYour task is to Calculate a + b.?InputInput contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.?OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.?Sample Input1 510 200 0?Sample Output630?Authorlcy?RecommendJGShining解答:#include<stdio.h>main(){int a,b;scanf("%d %d",&a,&b);while(!(a==0&&b==0)){printf("%d\n",a+b);scanf("%d %d",&a,&b);}}1092A+B for Input-Output Practice (IV)Problem DescriptionYour task is to Calculate the sum of some integers.?InputInput contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.?OutputFor each group of input integers you should output their sum in one line, and with one line of output for each line in input.?Sample Input4 1 2 3 45 1 2 3 4 5?Sample Output1015?Authorlcy?RecommendJGShining?解答:#include <stdio.h>int main(){int n,sum,i,t;while(scanf("%d",&n)!=EOF&&n!=0){sum=0;for(i=0;i<n;i++){scanf("%d",&t);sum=sum+t;}printf("%d\n",sum);}}1093 A+B for Input-Output Practice (V)Problem DescriptionYour task is to calculate the sum of some integers.?InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.?OutputFor each group of input integers you should output their sum in one line, and with one line of output for each line in input.?Sample Input24 1 2 3 45 1 2 3 4 5?Sample Output1015?Authorlcy解答:#include<stdio.h>main(){int n,a,b,i,j,sum;sum=0;while(scanf("%d\n",&n)!=-1){for(i=0;i<n;i++){scanf("%d",&b);for(j=0;j<b;j++){scanf("%d",&a);sum+=a;}printf("%d\n",sum);sum=0;}}}1094 A+B for Input-Output Practice (VI)Problem DescriptionYour task is to calculate the sum of some integers.?InputInput contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line.?OutputFor each test case you should output the sum of N integers in one line, and with one line of output for each line in input.?Sample Input4 1 2 3 45 1 2 3 4 5?Sample Output1015?Authorlcy?RecommendJGShining解答:#include<stdio.h>main(){int n,a,b,i,j,sum;sum=0;while(scanf("%d\n",&n)!=-1){for(j=0;j<n;j++){scanf("%d",&a);sum+=a;}printf("%d\n",sum);sum=0;}}[ Copy to Clipboard ]????[ Save to File]1095A+B for Input-Output Practice (VII)Problem DescriptionYour task is to Calculate a + b.?InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.?OutputFor each pair of input integers a and b you should output the sum of a and b, and followed by a blank line.?Sample Input1 510 20?Sample Output630?Authorlcy?RecommendJGShining解答:#include<stdio.h>main(){int a,b;while(scanf("%d%d",&a,&b)!=EOF)printf("%d\n\n",a+b);}1096 A+B for Input-Output Practice(VIII)Problem DescriptionYour task is to calculate the sum of some integers.?InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.?OutputFor each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.?Sample Input34 1 2 3 45 1 2 3 4 53 1 2 3?Sample Output10156?Authorlcy?RecommendJGShining解答:int main(){int a,b,i,j,l[1000],k;scanf("%d",&i);getchar();for(j=1;j<=i;j++)l[j]=0;for(j=1;j<=i;j++){scanf("%d",&a);getchar();for(k=1;k<=a;k++){scanf("%d",&b);getchar();l[j]+=b;}}for(j=1;j<=i-1;j++)printf("%d\n\n",l[j]);printf("%d\n",l[i]);}2000 ASCII码排序Problem Description输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
杭州电子科技大学acm题目分类
杭州电子科技大学acm题目分类1002 简单的大数1003 DP经典问题,最大连续子段和1004 简单题1005 找规律(循环点)1006 感觉有点BT的题,我到现在还没过1007 经典问题,最近点对问题,用分治1008 简单题1009 贪心1010 搜索题,剪枝很关键10111012 简单题1013 简单题(有个小陷阱)1014 简单题1015 可以看作搜索题吧1016 经典的搜索1017 简单数学题1018 简单数学题1019 简单数学题1020 简单的字符串处理1021 找规律的数学题1022 数据结构的题(栈的应用)1023 特殊的数(Catalan Number)1024 经典DP,最大M子段和1025 经典DP,最长递增子序列(要用NLogN的方法过)1026 搜索1027 数学题(或用STL)1028 经典问题,整数拆分,用母函数做1029 简单题(一般方法容易超时)1030 简单题,可用模拟过1031 简单题1032 简单题1033 模拟题1034 Candy Sharing Game1035 模拟题1036 简单题1037 简单题,不是一般的简单1038 简单题1039 字符串处理1040 简单题,排序1041 简单题,用大数1042 大数1043 经典搜索题,八数码问题1044 稍微有点麻烦的搜索题1045 搜索题,可用匹配做1046 简单题1047 简单的大数1048 简单字符串处理1049 简单题1050 贪心1051 经典贪心,也可以用DP1052 贪心1053 贪心,关于Huffman编码1054 二分匹配1055 二分匹配1056 简单题1057 模拟题1058 经典问题,丑数,DP1059 经典问题,可以用母函数或DP(不针对题目优化都会超时)1060 数学题1061 数学题1062 简单字符串处理1063 模拟大数1064 简单题1065 简单题1066 数学题,找规律10671068 经典二分匹配1069 经典DP1070 简单题1071 简单数学题1072 搜索1073 字符串处理1074 DP1075 字典树1076 简单题10771078 DP1079 博弈(DP)1080 DP1081 经典DP1082 简单题1083 二分匹配1084 简单题1085 母函数1086 简单几何题1087 简单DP1088 字符串处理1089~1096 (练习输入输出的8个题目)1097 简单数学题1098 数学题,注意找规律1099 数学题模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201 1202 1205 1209 1212(大数取模) 1216(链表)1218 1219 1225 1228 1229 1230 1234 1235 1236 1237 1239 12501256 1259 1262 1263 1265 1266 1276 1279 1282 1283 1287 1296 13021303 1304 1305 1306 1309 1311 1314复杂模拟搜索,递归求解1010 1016 1026 1043(双广) 1044 (BFS+DFS) 1045 1067 1072 1104 1175 1180 1195 1208 1226 1238 1240 1241 1242 1258 1271 1312 1317 博奕1079动态规划1003 1024 1025 1028 1051 1058 1059 1069 1074 1078 1080 1081 1085 1087 1114 1158 1159 1160 1171 1176 1181 1203 1224 1227 1231 1244 1248 1253 1254 1283 1300数学,递推,规律1005 1006 1012 1014 1018 1019 1021 1023 1027 1030 1032 1038 1041 1046 1059 1060 1061 1065 1066 1071(微积分) 1097 1098 1099 1100 1108 1110 1112 1124 1130 1131 1132 1134 1141 1143 1152 1155(物理题) 1163 1165 1178 1194 1196(lowbit) 1210 1214 1200 1221 1223 1249 1261 1267 1273 1290 1291 1292 1294 1297 1313 1316数论1164 1211 1215 1222 1286 1299计算几何1086 1115 1147贪心1009 1052 1055 1257并查集1198 1213 1232 1272线段树,离散化1199 1255图论最短路相关的问题1142 1162 1217 1301二分图问题1054 1068 1150 1151 1281其他1053 (huffman) 1102(MST) 1116(欧拉回路)1233(MST) 1269(强连通)数据结构1103(堆+模拟)1166(数状树组)1247 1251 1285(Topol)1298汉诺塔系列1207最近顶点对10071500 DP1501 DP1502 DP or 记忆化1503 DP1504 模拟1505 DP1506 DP1507 2分匹配1508 记忆化容易点1509 模拟1510 DP1511 搜索可以过1512 左偏树1513 DP1514 DP1515 DFS1516 DP1517 博奕1518 搜索1519 DP(不确定)1520 树状DP1521 数学题,母函数什么的。
acm题库周日正赛前热身题
1.Problem Description输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
Input输入数据有多组,每组占一行,有三个字符组成,之间无空格。
Output对于每组输入数据,输出一行,字符中间用一个空格分开。
Sample InputqweasdzxcSample Outpute q wa d sc x zAuthorlcySourceC语言程序设计练习(一)2.RecommendProblem Description输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。
Input输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开。
Output对于每组输入数据,输出一行,结果保留两位小数。
Sample Input0 0 0 10 1 1 0Sample Output1.001.41AuthorlcySourceC语言程序设计练习(一)RecommendJGShining3.Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T<=20) which means the number of test cases. Then T lines follow, each line consists of two positive integers, A and B. Notice that the integers are very large, that means you should not process them by using 32-bit integer. You may assume the length of each integer will not exceed 1000.OutputFor each test case, you should output two lines. The first line is "Case #:", # means the number of the test case. The second line is the an equation "A + B = Sum", Sum means the result of A + B. Note there are some spaces int the equation. Output a blank line between two test cases.Sample Input21 2112233445566778899 998877665544332211Sample OutputCase 1:1 +2 = 3Case 2:112233445566778899 + 998877665544332211 = 1111111111111111110 4.AuthorIgnatius.LProblem Description根据输入的半径值,计算球的体积。
杭州电子科技大学ACM刷题
}
}
}
2010
importjava.util.Scanner;
public class Work1 {
public static void main(String[]args) {
Scannersc=new Scanner(System.in);
intm,n,a,b,c,i,sum,num;
2008
importjava.util.Scanner;
public class Work {
public static void main(String[]args) {
inti,n,a,b,c;
Scannersc=new Scanner(System.in);
double[] x=new double [100];
Scannersc=new Scanner(System.in);
intn,i,j,t;
int[] a=newint[100];
n=sc.nextInt();
while(n!=0)
{
if(n>100) continue;
for(i=0;i<n;i++)
{
a[i]=sc.nextInt();
}
for(i=0;i<n;i++)
public class Work2 {
public static void main(String[]args) {
Scannersc=new Scanner(System.in);
intx,y,n,s,i,j;
x=sc.nextInt();
y=sc.nextInt();
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
intn,i,j,t;
int[] a=newint[100];
n=sc.nextInt();
while(n!=0)
{
if(n>100) continue;
for(i=0;i<n;i++)
{
a[i]=sc.nextInt();
}
for(i=0;i<n;i++)
System.out.printf("%d\n",b[i]);
}
s=0;
k=0;
c=0;
n=sc.nextInt();
m=sc.nextInt();
}
}
}
2020
importjava.util.Scanner;
ng.Math;
public class Work4 {
public static void main(String[]args) {
{
s+=a[c];
c++;
}
b[k]=s/m;
s=0;
k++;
}
for(c=c;c<n;c++)
{
s+=a[c];
}
if(t!=0)
b[k]=s/t;
if(t==0)
k--;
for(i=0;i<k+1;i++)
{
if(i<k)
System.out.printf("%d ",b[i]);
if(i==k)
{
for(n=x,j=0;n<=y;n++)
{
s=n*n+n+41;
for(i=2;i<s/2;i++)
if (s%i==0)
j++;
}
if(j==0)
System.out.println("OK");
else
System.out.println("Sorry");
x=sc.nextInt();
y=sc.nextInt();
n=sc.nextInt();
while(n!=0)
{
Hale Waihona Puke a=b=c=0;for(i=0;i<n;i++)
{
x[i]=sc.nextDouble();
if(x[i]<0)
a++;
else if(x[i]==0)
b++;
else
c++;
}
System.out.printf("%d %d %d\n",a,b,c);
{
for(j=i;j<n;j++)
{
if(Math.abs(a[j])>Math.abs(a[i]))
{
t=a[i];
a[i]=a[j];
a[j]=t;
}
}
if(i>0)
System.out.printf(" ");
System.out.printf("%d",a[i]);
}
System.out.println();
2008
importjava.util.Scanner;
public class Work {
public static void main(String[]args) {
inti,n,a,b,c;
Scannersc=new Scanner(System.in);
double[] x=new double [100];
m=sc.nextInt();
n=sc.nextInt();
while(m>=100&&n<=999)
{
num=0;
for(i=m;i<=n;i++)
{
a=i/100;
b=i%100/10;
c=i%10;
sum=a*a*a+b*b*b+c*c*c;
if(sum==i)
{
if(num>=1)
System.out.printf(" ");
n=sc.nextInt();
}
}
}
2010
importjava.util.Scanner;
public class Work1 {
public static void main(String[]args) {
Scannersc=new Scanner(System.in);
intm,n,a,b,c,i,sum,num;
System.out.printf("%d",i);
num++;
}
}
if(num==0)
System.out.println("no");
else
System.out.println();
m=sc.nextInt();
n=sc.nextInt();
}
}
}
2012
importjava.util.Scanner;
n=sc.nextInt();
}
}
}
public class Work2 {
public static void main(String[]args) {
Scannersc=new Scanner(System.in);
intx,y,n,s,i,j;
x=sc.nextInt();
y=sc.nextInt();
while(x!=0||y!=0)
int[] a=newint[100];
int[] b=newint[100];
n=sc.nextInt();
m=sc.nextInt();
while(n!=0&&m!=0)
{
for(i=0;i<n;i++)
{
a[i]=2*(i+1);
}
t=n%m;
for(i=0;i<(n-t)/m;i++)
{
for(j=0;j<m;j++)
}
}
}
2015
importjava.util.Scanner;
public class Work3 {
public static void main(String[]args) {
Scannersc=new Scanner(System.in);
inti,j,k=0;
intn,m,t,c=0,s=0;