1001--Sum Problem(http://acm.hdu.edu.cn/showproblem.php?pid=1001)
#include <stdio.h> int sum(int n) { if(n % 2) return (n + 1) / 2 * n; else return (n / 2) * (n + 1); } int main() { int n; while(scanf("%d",&n) != EOF){ printf("%d ",sum(n)); } return 0; }
1002--A + B Problem II(http://acm.hdu.edu.cn/showproblem.php?pid=1002)
简单题:大数的运算
注意格式(Case的首字母大写、各种空格、每一行之间有空行,最后一行没有空行)!
给出几组测试数据:
61 2
1 0
9999 1
1 999999
5555 4445
112233445566778899 998877665544332211
#include<stdio.h> #include<string.h> #include<stdlib.h> void solve() { int n,i,j,k,flag,t,cas,L; char a[1001],b[1001],c[1002]; scanf("%d",&n); getchar(); cas=1; while(n--) { flag=0; memset(a,'