摘要: http://ac.jobdu.com/problem.php?id=1036 暴力View Code 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 int n,x,y,z; 6 while(cin>>n) 7 { 8 cin>>x>>y>>z; 9 int i,j,temp,val,a,b;10 temp=x*1000+y*100+z*10;11 bool flag=false;12 for(i=9;i>0 && !f... 阅读全文
posted @ 2012-04-02 23:44 keepmoving89 阅读(365) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1076View Code 1 #include<iostream> 2 using namespace std; 3 bool isleap(int year) 4 { 5 if(year%4==0 && year%100!=0) return true; 6 if(year%400==0) return true; 7 return false; 8 } 9 int main()10 {11 int t,year,num;12 cin>>t;13 while(t-.. 阅读全文
posted @ 2012-04-02 20:38 keepmoving89 阅读(130) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1062 字符串反转,简单View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cstdlib> 4 #include<cstdio> 5 using namespace std; 6 char line[1008]; 7 void reverse() 8 { 9 string temp;10 int i,len=strlen(line);11 for(i=0;i<len;i++)12 { 阅读全文
posted @ 2012-04-02 19:28 keepmoving89 阅读(126) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1060 m=n^n;两边同取对数,log10(m)=n*log10(n); m=10^(n*log10(n))=(10^n)*(10^(n*log10(n))然后,对于10的整数次幂,第一位是1,所以,左边第一位数取决于n*log10(n)的小数部分View Code 1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 int main() 5 { 6 int n,t; 7 cin>>t; 8 wh 阅读全文
posted @ 2012-04-02 19:14 keepmoving89 阅读(127) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1059 多重背包View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cmath> 4 using namespace std; 5 int dp[120008]; 6 int num[7],total=0;// 7 bool dp1()//能装一半,返回true 8 { 9 memset(dp,0,sizeof(dp));10 int half=total/2;11 //cout<<&quo 阅读全文
posted @ 2012-04-02 17:34 keepmoving89 阅读(255) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1056简单 模拟View Code 1 #include<iostream> 2 #include<cmath> 3 #include<cstring> 4 using namespace std; 5 int main() 6 { 7 double len; 8 while(cin>>len && len) 9 {10 double sum=1.0/2.0;11 if(sum>=len) {cout<<"1 card 阅读全文
posted @ 2012-04-02 12:47 keepmoving89 阅读(144) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1051 先对length排序,再找出weight的递增序列(不一定连续) 个数View Code 1 #include<iostream> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 struct node 6 { 7 int x,y; 8 }; 9 node a[5008];10 bool flag[5008];11 int n;12 bool cmp(const node & 阅读全文
posted @ 2012-04-02 11:07 keepmoving89 阅读(229) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1049 模拟题View Code 1 #include<iostream> 2 #include<vector> 3 #include<cstring> 4 #include<cstdlib> 5 using namespace std; 6 int main() 7 { 8 int n,u,d; 9 while(cin>>n>>u>>d)10 {11 if(n==0 && u==0 && d= 阅读全文
posted @ 2012-04-02 09:57 keepmoving89 阅读(127) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1047 大数相加,没ACView Code 1 #include<iostream> 2 #include<vector> 3 #include<cstring> 4 #include<cstdlib> 5 using namespace std; 6 void add(string a,string b,string &sum) 7 { 8 sum=""; 9 int alen=a.length(),blen=b.length(); 阅读全文
posted @ 2012-04-02 09:20 keepmoving89 阅读(136) 评论(0) 推荐(0) 编辑