文章分类 -  九度

摘要:#include<iostream>#include<algorithm>#include<string.h>using namespace std;int main(){ int a[10],b[101]; int i,j,t,max; while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7]>>a[8]>>a[9]) { max=a[0]; memset(b,0,sizeof(b 阅读全文
posted @ 2013-01-23 16:19 dupuleng 阅读(93) 评论(0) 推荐(0) 编辑
摘要:浮点数表示并不精确,所以不可将float变量用“==”或“!=”与数字比较,尽量转为整数进行比较http://bbs.csdn.net/topics/340023422有讨论View Code 1 #include<iostream> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 int main() 6 { 7 int n1=5,n2=4,n3=6; 8 int m1=8,m2=10,m3=18; 9 int temp,a[210];10 int num=0;11 . 阅读全文
posted @ 2013-01-22 17:18 dupuleng 阅读(109) 评论(0) 推荐(0) 编辑
摘要:View Code 1 #include<iostream> 2 #include<string> 3 #include<string.h> 4 using namespace std; 5 6 string standard="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; 7 string s; 8 char replace[128]; 9 10 11 void Init()12 {13 int i,j=0,temp;14 15 for(i=1;i<standard. 阅读全文
posted @ 2013-01-22 10:18 dupuleng 阅读(94) 评论(0) 推荐(0) 编辑
摘要:http://ac.jobdu.com/problem.php?pid=1039View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<string> 4 using namespace std; 5 6 int main() 7 { 8 int n,i; 9 10 while(cin>>n)11 {12 string s,temp;13 for(i=0;i<n;++i)14 {15 cin>>s;16 ... 阅读全文
posted @ 2013-01-20 22:31 dupuleng 阅读(95) 评论(0) 推荐(0) 编辑
摘要:View Code 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 int main() 5 { 6 int n,a[1000],i,j; 7 while(cin>>n) 8 { 9 for(i=0;i<n;++i)10 cin>>a[i];11 sort(a,a+n);12 i=0;j=0;13 while(i<n)14 {15 if(a[i]!=a[j... 阅读全文
posted @ 2013-01-20 20:55 dupuleng 阅读(87) 评论(0) 推荐(0) 编辑
摘要:View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<string.h> 4 using namespace std; 5 6 int fac[11]; 7 int a[20],flag=0; 8 int factorial(int n) 9 {10 if(n==0)11 return 1;12 else if(n==1)13 return 1;14 else15 return factorial(n-1)*n;16 }17 void cal_f... 阅读全文
posted @ 2013-01-20 20:38 dupuleng 阅读(98) 评论(0) 推荐(0) 编辑
摘要:http://ac.jobdu.com/problem.php?pid=1099View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<string> 4 #include<vector> 5 using namespace std; 6 7 int main() 8 { 9 string s;10 int i;11 12 while(cin>>s)13 {14 string arr[100],temp;15 vector<string> vec;.. 阅读全文
posted @ 2013-01-20 15:06 dupuleng 阅读(97) 评论(0) 推荐(0) 编辑
摘要:http://ac.jobdu.com/problem.php?pid=1095这个题主要需要注意输出时的括号匹配View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<string> 4 #include<stack> 5 6 using namespace std; 7 int mycount=0; 8 stack<int> intStack; 9 10 void f(int n)11 {12 int m,num=-1;13 while( n)14 {15 m 阅读全文
posted @ 2013-01-19 14:31 dupuleng 阅读(122) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int N,K; 6 while(scanf("%d%d",&N,&K)!=EOF) 7 { 8 int m; 9 double t;10 for(m=1;m<=20;++m)11 {12 t=200*pow(1+K*1.0/100,m-1);13 if(N*m*1.0>=t)14 {15 ... 阅读全文
posted @ 2012-04-26 14:57 dupuleng 阅读(91) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 int map[301][301]; 3 int cal(int n) 4 { 5 int i,j,sum=0; 6 for(i=1;i<n;++i) 7 { 8 for(j=i+1;j<=n;++j) 9 sum+=map[i][j];10 }11 return sum;12 }13 int main()14 {15 int n,k,a,b,w;16 while(scanf("%d",&n)!=EOF)17 {18 int i,... 阅读全文
posted @ 2012-04-18 17:04 dupuleng 阅读(113) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h>#include<algorithm>#include<string.h>using namespace std;typedef struct { int weight; char hat[101];}mouse;int cmp(mouse a,mouse b){ return a.weight>b.weight;}int main(){ int n; mouse m[101]; while(scanf("%d",&n)!=EOF) { int i; for(i=0;i<n;++i) 阅读全文
posted @ 2012-04-16 17:35 dupuleng 阅读(113) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 6 typedef struct 7 { 8 int start; 9 int end;10 int cost;11 }Ege;12 Ege s[10001];13 int fa[1001];14 int cmp(Ege a,Ege b)15 {16 return a.cost<b.cost;17 }18 int get_father(int n)19 {20 if(fa[n.. 阅读全文
posted @ 2012-04-16 17:27 dupuleng 阅读(88) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 5 typedef struct TreeNode 6 { 7 int value; 8 struct TreeNode*left; 9 struct TreeNode*right;10 }*Node;11 void insert(Node &root,int v)12 {13 if(!root)14 {15 root=(Node)malloc(sizeof(TreeNode));16 ro... 阅读全文
posted @ 2012-04-16 16:48 dupuleng 阅读(111) 评论(0) 推荐(0) 编辑
摘要:1 #include <stdio.h> 2 #include <math.h> 3 int num[1005]; 4 int main() 5 { 6 int n; 7 while(scanf("%d",&n)!=EOF) 8 { 9 int i;10 for(i=1;i<=n;i++)11 scanf("%d",&num[i]);12 int d;13 scanf("%d",&d);14 if(d==1)15 printf("%d\n",num[1]);16 阅读全文
posted @ 2012-04-15 22:33 dupuleng 阅读(77) 评论(0) 推荐(0) 编辑
摘要:1 #include<stdio.h> 2 #include<string.h> 3 #include<iostream> 4 #include<stack> 5 using namespace std; 6 7 typedef struct 8 { 9 char ch;10 int pos;11 }Symbol;12 int main()13 {14 char s[100],flag[100];15 stack<Symbol> st;16 while(cin.getline(s,100))17 {18 memset(fl... 阅读全文
posted @ 2012-04-13 17:30 dupuleng 阅读(101) 评论(0) 推荐(0) 编辑
摘要:1 /**/ 2 3 4 #include<stdio.h> 5 typedef struct 6 { 7 int num; 8 int book_num; 9 int flag;10 }Student;11 Student s[1000];12 int main()13 {14 int n,m;15 while(scanf("%d%d",&n,&m)!=EOF&&n>=2&&m<=200)16 {17 int i,j;18 for(i=0;i<n;++i)19 {20 ... 阅读全文
posted @ 2012-04-13 16:32 dupuleng 阅读(109) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<stdio.h>#include<algorithm>using namespace std;typedef struct { int data; int pos; int cur;}Num; Num num[10001]; int cmp(Num a,Num b) { return a.data<b.data; }int main(){ int n; while(scanf("%d",&n)!=EOF&&n) { int i; for(i=0;i< 阅读全文
posted @ 2012-04-13 16:16 dupuleng 阅读(94) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h>#include<iostream>#include<algorithm>#include<string.h>using namespace std;int main(){ int n,a[10000]; while(scanf("%d",&n)!=EOF) { int k; memset(a,0,sizeof(a)); int i; for(i=0;i<n;++i) { scanf("%d",&a[i]); } cin>>k; sort( 阅读全文
posted @ 2012-04-13 11:49 dupuleng 阅读(84) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<queue>using namespace std;int main(){ int n; while(cin>>n&&n) { priority_queue<int,less<int>> PQ; for(int i=0;i<n;++i) { int temp; cin>>temp; PQ.push(temp); } int ret=0; while(PQ.size()>1) { int temp=0; temp+=PQ.top(); PQ.p 阅读全文
posted @ 2012-04-13 11:19 dupuleng 阅读(83) 评论(0) 推荐(0) 编辑
摘要:#include<stdio.h>#include<string.h>int bit_sum(int n){ int count=0; while(n) { count+=n%10; n/=10; } return count;} int main(){ int n; while(scanf("%d",&n)!=EOF&&n) { int count=0; int temp; count=bit_sum(n); temp=bit_sum(n*n); printf("%d %d\n",count,temp); 阅读全文
posted @ 2012-04-13 08:30 dupuleng 阅读(97) 评论(0) 推荐(0) 编辑