- 博客(66)
- 资源 (4)
- 收藏
- 关注
原创 HDOJ 1096 注意最后一个结果之后没有空行
#include #include //strlen#include //itoa,atoiusing namespace std;int main(){ int n,m,sum,a; scanf("%d",&n);
2011-09-19 22:19:33 499
原创 HDOJ 1013 Digital Roots
1#include #include //strlen#include //itoa,atoiusing namespace std;char a[13];int process(int number){ int ss = 0
2011-09-19 22:06:53 263
原创 HDOJ 1018 BigNumber
HDOJ 1018 Big Number这道之前我自己做的时候就在想是不是有规律的啊,这么大的一个数量级是不可能没有规律的,结果写了一系列的值,最后还是一点规律都没找到,郁闷死了,看到一篇文章,原来它是跟一个数学公式有关的啊,真的不知道哦。摘录如下(转载自lnkm的博客)
2011-09-19 19:50:16 354
原创 HDOJ 七夕节月老
水题, 不要想复杂了 , 只需要 从2 循环到 sqrt(n), 判断是否能整除就可以了.........#include#include#include using namespace std;int is_yinzi(int x){ int
2011-09-18 16:39:55 583
原创 POJ 百练 2980:大整数乘法
#include #include using namespace std;#define MaxNum 210int a[MaxNum];int b[MaxNum];char chara[MaxNum];char charb[MaxNum];in
2011-09-18 15:46:51 889
原创 HDOJ The Hardest Problem Ever 运行时错误Runtime Error (ACCESS_VIOLATION)可能是数组越界
Runtime Error(ACCESS_VIOLATION)#include #include using namespace std;int main(){ char start[11]; char body[1024];
2011-09-18 13:54:58 2071
原创 HDOJ 1091
#include using namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF){ if(m==0&&n==0) brea
2011-09-18 13:10:16 326
原创 HDOJ 1094
#include using namespace std;int main(){ int n,sum; while(scanf("%d",&n)!=EOF){ sum = 0; int a; f
2011-09-18 13:08:13 252
原创 HDOJ 1093
#include using namespace std;int main(){ int n,sum; scanf("%d",&n); while(n--){ int m; scanf("%d",&m)
2011-09-18 13:04:51 268
原创 HDOJ 1092 scanf("%d",&n)&&n!=0
#include using namespace std;int main(){ int n,sum; while(scanf("%d",&n)!=EOF&&n!=0){ //scanf("%d",&n)&&n!=0 sum =
2011-09-18 13:02:22 572
原创 HDOJ 1090 输入以特殊的n组为标记
#include using namespace std;int main(){ int n; scanf("%d",&n); while(n--){ int a,b; scanf("%
2011-09-18 12:57:06 310
原创 HDOJ 1089 输入不说明有几组数据,以EOF为标记
#include using namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)=!EOF){ printf("%d\n",n+m);
2011-09-18 12:53:30 611
原创 HDOJ 1001 两个数相乘容易溢出 所以要初二
#includeint main(){int n;while(scanf("%d",&n),n>0) printf("%d\n\n",n%2?(n+1)/2*n:n/2*(n+1));return 0;}
2011-09-18 12:48:11 363
原创 HDU 纸牌木板
#include using namespace std;int main(){ double n; int i; while(scanf("%lf",&n)!=EOF){ if(n==0.00)
2011-09-18 00:24:55 259
原创 最大公约数gcd 最小公倍数
如果有一个自然数a能被自然数b整除,则称a为b的倍数,b为a的约数。几个自然数公有的约数,叫做这几个自然数的公约数。公约数中最大的一个公约数,称为这几个自然数的最大公约数。 X,Y的最大公约数*最小公倍数=X*Yint zuidagongyue(int da,int xiao){ int temp; while(xiao!=0) {
2011-09-17 23:35:31 430
原创 HDU Fighting for HDU
注意n是变量#include #include using namespace std;int cmp(const void* s1,const void* s2){ int * p1; int * p2; p1 = (i
2011-09-17 11:22:19 463
原创 qsort sort
#include int cmp(const void* a,const void* b){ int *s1; int *s2; s1 = (int *)a; s2 = (int *)b; return *s1 - *
2011-09-16 20:44:44 229
原创 HDU 倒数第二小
#include //#include #include //#include using namespace std;bool cmp(int a,int b){ return a}int a[20];int main()
2011-09-16 20:38:14 231
原创 HDU A^B
#include #include using namespace std;int main(){ long long a,b; while(scanf("%I64d%I64d",&a,&b)!=EOF){ i
2011-09-16 18:15:20 294
原创 C语言语法
printf("%.01f\n",(double)2/1);printf("%.02f\n",(double)2/1); 保留两位小数数组赋值#include memset(al,0,sizeof(al));输入浮点数while(scanf("%l
2011-09-16 13:42:32 657
原创 HDU GPA
#include using namespace std;char line[100000];int main(){ while( gets(line)) { //int num[26] = {0};
2011-09-16 13:41:32 403
原创 HDU AC me
#include using namespace std;char line[100000];int main(){ while( gets(line)) { int num[26] = {0};
2011-09-16 13:41:06 313
原创 HDU hide handkerchief 最大公约数=1
#include using namespace std;int main(){ int N,M; int temp; while(scanf("%d%d",&N,&M)!=EOF) { if(
2011-09-16 13:40:29 288
原创 HDU IBM Minus One
#include #include #include#include using namespace std;int main(){ int n,i,j; while(scanf("%d",&n)!=EOF){
2011-09-15 01:28:42 338
原创 HDU Buildings
#include #includeusing namespace std;int main(){ int T,i,j; while(scanf("%d",&T)!=EOF){ int n,m,sum,g;
2011-09-14 23:57:02 234
原创 Lowest Bit
#include #include #includeusing namespace std;int main(){ int n,b; scanf("%d",&n); while(n){ b = 0
2011-09-14 22:29:05 235
原创 HDU 1.2.1
#include using namespace std;int main(){ int n,u,d; int sum,minute; while(scanf("%d%d%d",&n,&u,&d)!=EOF && d
2011-09-14 20:37:18 308
原创 HDU 1096 A+B
#include using namespace std;int main(){ int n; scanf("%d",&n); while(n--) { int m; scan
2011-09-14 20:04:29 308
原创 折半插入排序(Binary Insert Sort)
int low=0,mid,high=n-1;while(low mid = (low+high)/2; if(x high = mid - 1; else low = mid+1;}for(i=
2011-09-14 16:43:06 392
原创 多边形的面积
可以利用多边形求面积公式:S = 0.5 * ( (x0*y1-x1*y0) + (x1*y2-x2*y1) + ... + (xn*y0-x0*yn) )其中点(x0, y0), (x1, y1), ... , (xn, yn)为多边形上按逆时针顺序的顶点#in
2011-09-13 08:59:33 243
原创 C++程序中memset
先看看下面的代码:char Array[12];memset(Array,0,strlen(Array));int Result = 0;if(!Array){ Result = 1;}程序执行到最后,Result的值还是为0.memset
2011-09-13 08:42:42 479
原创 HDU 2034 A-B
#include #include #include using namespace std;int main(){ //freopen("h2034.txt","r",stdin); int n,m,i,temp; set a; wh
2011-09-13 08:32:06 1249
原创 C++ set与multiset
C++ STL set和multiset的使用1,set的含义是集合,它是一个有序的容器,里面的元素都是排序好的,支持插入,删除,查找等操作,就 像一个集合一样。所有的操作的都是严格在logn时间之内完成,效率非常高。 set和multiset的区别是:set插入的元素不能相
2011-09-13 08:30:51 1020
原创 HDU 2033 A+B
#include using namespace std;int main(){ int a,b,c,d,e,f,n; while(scanf("%d",&n)!=EOF){ for(int i = 0;i
2011-09-12 18:01:29 304
原创 HDU 2035 后三位
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2035这道题目,初看貌似是水题,其实还是有一定的难度的。因为当A和B非常大时,就超出int的范围了。所以这题考的是数学技巧。首先,45896的7次方的后三位和896的7次方的后三位
2011-09-10 21:35:28 811
原创 1061 n^n的个位数
//http://acm.hdu.edu.cn/showproblem.php?pid=1061题目的意思很简单,就是要求出n的n次幂的各位数字。但是n的范围非常大。1代码:#includeusing namespace std;
2011-09-10 20:49:07 427
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人