2013年5月2日

HDOJ 1061 Rightmost Digit

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1061这道题目的意思是,给你一个很大的整数N(1<=N<=1,000,000,000),要你求N的N次方的最后一位数字,一开始想到用一个数字保留每次乘法的个位数,但是超时了, 1 #include<iostream> 2 using namespace std; 3 int main(){ 4 long n,m,num,p; 5 cin>>num; 6 while(num--){ 7 cin>>n; 8 m = p = n % 10; 9 ... 阅读全文

posted @ 2013-05-02 11:10 wsxjbcy 阅读(291) 评论(0) 推荐(0)

HDOJ 1108 最小公倍数

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1108#include<iostream>//这里用的暴力循环的方法,没有考虑它的时间复杂度,还可以有辗转相除法,using namespace std;int main(){ int n=0,m=0,k=1,minG; while(cin>>n>>m){ if(n>m){ for(int i=1;i<=m;i++){ if(n%i==0 && m%i==0) k=i; }... 阅读全文

posted @ 2013-05-02 10:24 wsxjbcy 阅读(321) 评论(0) 推荐(0)

HDOJ 1008 Elevator

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1008题目的大概意思是,电梯每次上楼需要6秒,下楼需要4秒,在每一层都要停5秒,输入一连串的数据,要求出总共花费的时间,这是一道简单的题目,别把它往复杂的地方想, 1 #include<iostream> 2 using namespace std; 3 int main(){ 4 int n,m,sum=0,now=0; 5 for(;;){ 6 cin>>n; 7 if(n==0)break; 8 sum=0; 9 now=0... 阅读全文

posted @ 2013-05-02 10:19 wsxjbcy 阅读(215) 评论(0) 推荐(0)

HDOJ 1096 A+B for Input-Output Practice (VIII)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1096acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了, 1 #include<stdio.h> 2 int main() 3 { 4 int a , b , N , i , M; 5 scanf( "%d" , &M ); 6 for( int j = 0; j < M; j++ ) 7 { 8 scanf( "%d" , &N ); 9 int sum = 0;10 for( i = 0; i < N; i+ 阅读全文

posted @ 2013-05-02 09:56 wsxjbcy 阅读(180) 评论(1) 推荐(0)

HDOJ 1095 A+B for Input-Output Practice (VII)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1095acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了,1 #include<iostream>2 using namespace std;3 int main (){4 int a,b;5 while(cin>>a>>b){6 cout<<a+b<<endl<<endl;7 }8 return 0;9 } 阅读全文

posted @ 2013-05-02 09:53 wsxjbcy 阅读(145) 评论(0) 推荐(0)

HDOJ 1094 A+B for Input-Output Practice (VI)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1094acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了, 1 #include<iostream> 2 #include<stdio.h> 3 using namespace std; 4 int main (){ 5 int a,n; 6 while(scanf("%d",&n)!=EOF){ 7 int sum=0; 8 for(int i=0;i<n;i++){ 9 cin>>a;10 su... 阅读全文

posted @ 2013-05-02 09:50 wsxjbcy 阅读(117) 评论(0) 推荐(0)

HDOJ 1093 A+B for Input-Output Practice (V)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1093acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了,#include<iostream>using namespace std;int main (){ int a,n,m; cin>>m; for(int j=0;j<m;j++){ int sum=0; cin>>n; for(int i=0;i<n;i++){ cin>>a; sum+=a; } cou... 阅读全文

posted @ 2013-05-02 09:46 wsxjbcy 阅读(147) 评论(0) 推荐(0)

HDOJ 1092 A+B for Input-Output Practice (IV)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1092acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了, 1 #include<iostream> 2 using namespace std; 3 4 int main (){ 5 int a,n; 6 for(;;){ 7 int sum=0; 8 cin>>n; 9 if(n==0)10 break;11 for(int i=0;i<n;i++){12 cin>>a... 阅读全文

posted @ 2013-05-02 09:44 wsxjbcy 阅读(133) 评论(0) 推荐(0)

HDOJ 1091 A+B for Input-Output Practice (III)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1091acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了, 1 #include<iostream> 2 using namespace std; 3 int main (){ 4 int a,b; 5 while(true){ 6 cin>>a>>b; 7 if(a==0 && b==0) 8 break; 9 cout<<a+b<<endl;10 }11 return 0;12 } 阅读全文

posted @ 2013-05-02 09:42 wsxjbcy 阅读(174) 评论(0) 推荐(0)

HDOJ 1090 A+B for Input-Output Practice (II)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1090acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了, 1 #include<iostream> 2 using namespace std; 3 int main (){ 4 5 int a,b,n,i=0; 6 cin>>n; 7 while(i<n){ 8 cin>>a>>b; 9 cout<<a+b<<endl;10 i++;11 }12 return 0;13 } 阅读全文

posted @ 2013-05-02 09:39 wsxjbcy 阅读(129) 评论(0) 推荐(0)

HDOJ 1089 A+B for Input-Output Practice (I)

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1089acm常见的输入输出类型,就是一种模板,花一点点时间背下来就可以了,1 #include<iostream>2 using namespace std;3 int main (){4 int a,b;5 while(cin>>a>>b)6 cout<<a+b<<endl;7 return 0;8 } 阅读全文

posted @ 2013-05-02 09:32 wsxjbcy 阅读(104) 评论(0) 推荐(0)

导航