随笔分类 -  HDUACM

一些acm题目解答
摘要:#include<stdio.h>#include<string.h>const int MAXN=200;char str[MAXN]; bool isvowel(char c){ if(c=='a'||c=='e'||c=='i'||c=='u'||c=='o') return true; el 阅读全文
posted @ 2017-01-14 23:43 王坤1993 阅读(166) 评论(0) 推荐(0)
摘要:#include <stdio.h> #define P 3.1415927 #define toFeet(x) x/12.0 #define toMiles(x) x/5280.0 int main(){ double diameter;//直径 int revolutions;//转数 doub 阅读全文
posted @ 2017-01-14 23:40 王坤1993 阅读(149) 评论(0) 推荐(0)
摘要:#include <iostream> #include <cstdio> using namespace std; int main() { int a,b,c; while (~scanf("%d%d%d",&a,&b,&c)) { if (a>168&&b>168&&c>168) printf 阅读全文
posted @ 2017-01-14 23:39 王坤1993 阅读(183) 评论(0) 推荐(0)
摘要:#include<stdio.h>int main(){ int n; double d; int num; char h,m1,m2,s1,s2; scanf("%d",&n); scanf("%lf",&d); while(scanf("%d",&num)!=EOF) { printf("%3d 阅读全文
posted @ 2017-01-14 23:37 王坤1993 阅读(162) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<string.h>int step,n,m;int a[1010][1010];char map[11][11];void DFS(int x,int y){ while(x>=0&&y>=0&&x<n&&y<m&&map[x][y]!='O') 阅读全文
posted @ 2017-01-14 23:34 王坤1993 阅读(189) 评论(0) 推荐(0)
摘要:#include<stdio.h>const int MAXN=1000;int a[MAXN];int main(){ int n; int i; while(scanf("%d",&n),n) { for(i=0;i<n;i++) scanf("%d",&a[i]); int res=0; wh 阅读全文
posted @ 2017-01-14 23:33 王坤1993 阅读(227) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<string.h> const int MAXN=200; char str[MAXN]; int main() { int x,y; while(scanf("%s",&str)!=EOF) { int len=strlen(str); int 阅读全文
posted @ 2017-01-14 23:32 王坤1993 阅读(148) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; int main() { int a,b,t,i,max; while(cin >> a >> b) { cout << a << " " << b << " "; if(a>b)//大小不确定 { t = a; a 阅读全文
posted @ 2017-01-13 21:09 王坤1993 阅读(178) 评论(0) 推荐(0)
摘要:#include <cstdio> #include <cstdlib> struct element{ int id; double sa; }e[10000]; int cmp(const void *a,const void *b){ return (*(element*)a).sa>(*(e 阅读全文
posted @ 2017-01-13 21:07 王坤1993 阅读(198) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<math.h>void find(int n,int &l,int &r,int &level){ int i; level=1; for(i=1;;i+=2) { if(n-i<=0) { l=(n+1)/2; r=(i-n)/2+1; brea 阅读全文
posted @ 2017-01-13 20:39 王坤1993 阅读(243) 评论(0) 推荐(0)
摘要:#include<iostream>#include<string.h>using namespace std;int main(){ int n,i; int t; int cnt; int result; while(scanf("%d",&n)!=EOF) { cnt=0; for(i=0;i 阅读全文
posted @ 2017-01-13 20:38 王坤1993 阅读(141) 评论(0) 推荐(0)
摘要:#include<stdio.h>#include<string.h>const int MAXN=130;int dp[MAXN][MAXN];//dp[i][j]表示 i 表示成最大的数不超过 j 的方法数int calc(int n,int m){ if(dp[n][m]!=-1) retur 阅读全文
posted @ 2017-01-13 20:37 王坤1993 阅读(147) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int SIZE=1002; int main() { int n,m; int i,count; int seq[SIZE]; wh 阅读全文
posted @ 2017-01-13 20:35 王坤1993 阅读(223) 评论(0) 推荐(0)
摘要:#include <stdio.h> #include <string.h> #include <queue> using namespace std; struct node { int x,y,step; friend bool operator<(node n1,node n2) { retu 阅读全文
posted @ 2017-01-13 20:32 王坤1993 阅读(175) 评论(0) 推荐(0)
摘要:#include<stdio.h>const int MAXN=500010;int a[MAXN],b[MAXN]; //用二分查找的方法找到一个位置,使得num>b[i-1] 并且num<b[i],并用num代替b[i]int Search(int num,int low,int high){ 阅读全文
posted @ 2017-01-13 20:29 王坤1993 阅读(184) 评论(0) 推荐(0)
摘要:#include <cstdio>#include <iostream>const int MAX = 1000005; using namespace std; int num[MAX], pre_max[MAX]; inline int max(int a, int b){ return a > 阅读全文
posted @ 2017-01-11 23:35 王坤1993 阅读(169) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <string.h>#define BASE 10000#define PFMT "%04d"#define MAX 105 void print_bn(int*a, int l){ int i; for(i=l-1;i>0;i--)if(a[i 阅读全文
posted @ 2017-01-11 23:34 王坤1993 阅读(229) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <string.h> int main(void){ int n,i,j,k,l; char o1[10],o2[10],s[10],h[20]; while(scanf("%d %s %s", &n, o1, o2)!=EOF) { memse 阅读全文
posted @ 2017-01-11 23:32 王坤1993 阅读(169) 评论(0) 推荐(0)
摘要:#include <stdio.h> int fib(int m){ int n_2=1,n_1=2,n,i; if(m==0)return 1; if(m==1)return 2; for(i=2;i<=m;i++) { n=(n_2+n_1)%3; n_2=n_1; n_1=n; } retur 阅读全文
posted @ 2017-01-11 23:31 王坤1993 阅读(141) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main(void){ int n,i,c; char txt[10001]; scanf("%d", &n); while(n--) { scanf("%s",txt); i=0; while(txt[i++]) { c=1; while(txt[i] 阅读全文
posted @ 2017-01-11 23:29 王坤1993 阅读(219) 评论(0) 推荐(0)