diff --git a/1166/main.c b/1166/main.c new file mode 100644 index 0000000..b2d64eb --- /dev/null +++ b/1166/main.c @@ -0,0 +1,93 @@ +#include + +struct node { + long from, to; + unsigned long long value; +}; + +int build_tree(struct node *tree,int *stations, long idx, int from, int to); +unsigned long long find_section(struct node *tree, long idx, int from, int to); +int add_point(struct node * tree, long idx, int p_idx, int value); +int sub_point(struct node * tree, long idx, int p_idx, int value); + +int stations[50000]; +struct node tree[200000]; + +int main(void) { + + int no; + scanf("%d",&no); + int k,i; + for(k = 0; k < no; k++){ + printf("Case %d:\n",k+1); + int n; + scanf("%d",&n); + for(i = 0; i < n; i++){ + scanf("%d",&stations[i]); + } + build_tree(tree, stations, 0, 1, n); + char order[6]; + while(scanf("%s",order) && order[0]!='E'){ + if(order[0]=='A'){ + int idx, peo; + scanf("%d %d",&idx,&peo); + add_point(tree, 0, idx, peo); + } + else if(order[0]=='S'){ + int idx, peo; + scanf("%d %d",&idx,&peo); + sub_point(tree, 0, idx, peo); + } + else if(order[0]=='Q'){ + int idxa, idxb; + scanf("%d %d",&idxa,&idxb); + printf("%llu\n",find_section(tree, 0, idxa, idxb)); + } + } + } + return 0; +} + +int build_tree(struct node *tree,int *stations, long idx, int from, int to){ + tree[idx].from = from; + tree[idx].to = to; + if(from - to){ + build_tree(tree, stations, 2*idx+1, from, (from+to)/2); + build_tree(tree, stations, 2*idx+2, (from+to)/2+1, to); + tree[idx].value = tree[2*idx+1].value + tree[2*idx+2].value; + } + else tree[idx].value = stations[from-1]; + return 0; +} + + +unsigned long long find_section(struct node *tree, long idx, int from, int to){ + long h_idx = (tree[idx].from + tree[idx].to)/2; + unsigned long long sum = 0; + if(tree[idx].from == from && tree[idx].to == to) return tree[idx].value; + else if(from <= h_idx && to > h_idx) + sum += find_section(tree, 2*idx+1, from, h_idx) + find_section(tree, 2*idx+2, h_idx+1, to); + else if(from <= h_idx && to <= h_idx) sum += find_section(tree,2*idx+1, from, to); + else if (from > h_idx && to > h_idx) sum += find_section(tree,2*idx+2, from, to); + return sum; +} + +int add_point(struct node * tree, long idx, int p_idx, int value){ + long h_idx = (tree[idx].from+tree[idx].to)/2; + tree[idx].value += value; + if(tree[idx].from < tree[idx].to){ + if(p_idx <= h_idx) add_point(tree, idx*2+1, p_idx, value); + else add_point(tree, idx*2+2, p_idx, value); + } + return 0; +} + +int sub_point(struct node * tree, long idx, int p_idx, int value){ + long h_idx = (tree[idx].from+tree[idx].to)/2; + tree[idx].value -= value; + if(tree[idx].from < tree[idx].to){ + if(p_idx <= h_idx) sub_point(tree, idx*2+1, p_idx, value); + else sub_point(tree, idx*2+2, p_idx, value); + } + return 0; +} diff --git a/1166/problem.set b/1166/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/1166/stdin b/1166/stdin new file mode 100644 index 0000000..e69de29 diff --git a/1166/stdout b/1166/stdout new file mode 100644 index 0000000..e69de29 diff --git a/1754/main.c b/1754/main.c new file mode 100644 index 0000000..c893270 --- /dev/null +++ b/1754/main.c @@ -0,0 +1,74 @@ +#include + +struct node { + long from, to; + long value; +}; + +int build_tree(struct node *tree,int *stations, long idx, long from, long to); +long find_section(struct node *tree, long idx, long from, long to); +int upd_point(struct node * tree, long idx, long p_idx, long value); + +#define MAX (200000+5) + +int students[MAX]; +struct node tree[4*MAX]; + +int main(void) { + long sn, cn, i; + while(scanf("%ld %ld",&sn,&cn) != EOF){ + for(i = 0; i < sn; i++) scanf("%d",students+i); + build_tree(tree, students, 0, 1, sn); + for(i = 0; i < cn; i++){ + char cmd[2]; + scanf("%s",cmd); + if(cmd[0] == 'Q'){ + long fidx, tidx; + scanf("%ld %ld",&fidx,&tidx); + printf("%ld\n",find_section(tree, 0,fidx, tidx)); + } + else if(cmd[0] == 'U'){ + long idx; + int value; + scanf("%ld %d",&idx,&value); + upd_point(tree, 0, idx, value); + } + } + } + return 0; +} + +int build_tree(struct node *tree,int *students, long idx, long from, long to){ + tree[idx].from = from; + tree[idx].to = to; + if(from < to){ + build_tree(tree, students, 2*idx+1, from, (from+to)/2); + build_tree(tree, students, 2*idx+2, (from+to)/2+1, to); + tree[idx].value = (tree[2*idx+1].value)>(tree[2*idx+2].value)?(tree[2*idx+1].value):(tree[2*idx+2].value); + } + else tree[idx].value = students[from-1]; + return 0; +} + +long find_section(struct node *tree, long idx, long from, long to){ + long h_idx = (tree[idx].from + tree[idx].to)/2; + if(tree[idx].from == from && tree[idx].to == to) + return tree[idx].value; + if(from <= h_idx && to > h_idx){ + long f = find_section(tree, idx*2+1, from, h_idx), s = find_section(tree, idx*2+2, h_idx+1, to); + return f>s?f:s; + } + else if(from <= h_idx && to <= h_idx) return find_section(tree, idx*2+1, from, to); + else if(from > h_idx && to > h_idx) return find_section(tree, idx*2+2, from, to); + else return 0; +} + +int upd_point(struct node * tree, long idx, long p_idx, long value){ + long h_idx = (tree[idx].from+tree[idx].to)/2; + if(tree[idx].from < tree[idx].to){ + if(p_idx <= h_idx) upd_point(tree, idx*2+1, p_idx, value); + else upd_point(tree, idx*2+2, p_idx, value); + } + if(tree[idx].value < value) tree[idx].value = value; + return 0; +} diff --git a/1754/problem.set b/1754/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/1754/stdin b/1754/stdin new file mode 100644 index 0000000..e69de29 diff --git a/1754/stdout b/1754/stdout new file mode 100644 index 0000000..e69de29 diff --git a/2000/main.c b/2000/main.c new file mode 100644 index 0000000..aaff72e --- /dev/null +++ b/2000/main.c @@ -0,0 +1,22 @@ +#include + +int main(void){ + char input[3] = {'\0'},temp = '\0'; + while(scanf("%c%c%c",&input[0],&input[1],&input[2]) == 3){ + int if_cge = 1,i = 0; + while(if_cge){ + if_cge = 0; + for(i = 0; i<2; i++){ + if(input[i] > input[i+1]){ + temp = input[i+1]; + input[i+1] = input[i]; + input[i] = temp; + if_cge = 1; + } + } + } + printf("%c %c %c\n",input[0],input[1],input[2]); + getchar(); + } + return 0; +} diff --git a/2000/problem.build b/2000/problem.build new file mode 100644 index 0000000..e1c0315 Binary files /dev/null and b/2000/problem.build differ diff --git a/2000/problem.build.dSYM/Contents/Info.plist b/2000/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/2000/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/2000/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/2000/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..521324a Binary files /dev/null and b/2000/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/2000/problem.set b/2000/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2000/stdin b/2000/stdin new file mode 100644 index 0000000..a72b0cc --- /dev/null +++ b/2000/stdin @@ -0,0 +1,3 @@ +qwe +asd +zxc diff --git a/2000/stdout b/2000/stdout new file mode 100644 index 0000000..53b47a6 --- /dev/null +++ b/2000/stdout @@ -0,0 +1,3 @@ +e q w +a d s +c x z diff --git a/2001/main.c b/2001/main.c new file mode 100644 index 0000000..8280d35 --- /dev/null +++ b/2001/main.c @@ -0,0 +1,12 @@ +#include +#include +#define TWOQ(x) ((x)*(x)) + +int main(void){ + double x1,x2,y1,y2; + while(scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2) == 4){ + printf("%.2lf\n",sqrt(TWOQ(x1-x2)+TWOQ(y1-y2))); + getchar(); + } + return 0; +} diff --git a/2001/problem.build b/2001/problem.build new file mode 100644 index 0000000..1c0d6d6 Binary files /dev/null and b/2001/problem.build differ diff --git a/2001/problem.set b/2001/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2001/stdin b/2001/stdin new file mode 100644 index 0000000..8a18485 --- /dev/null +++ b/2001/stdin @@ -0,0 +1,2 @@ +0 0 0 1 +0 1 1 0 diff --git a/2001/stdout b/2001/stdout new file mode 100644 index 0000000..064fc34 --- /dev/null +++ b/2001/stdout @@ -0,0 +1,2 @@ +1.00 +1.41 diff --git a/2002/main.c b/2002/main.c new file mode 100644 index 0000000..509c071 --- /dev/null +++ b/2002/main.c @@ -0,0 +1,12 @@ +#include +#define PI 3.1415927 +#define TQ(x) ((x)*(x)*(x)) + +int main(void){ + double r = 0.0; + while(scanf("%lf",&r) == 1){ + printf("%.3lf\n",(4.0/3.0)*PI*TQ(r)); + getchar(); + } + return 0; +} diff --git a/2002/problem.build b/2002/problem.build new file mode 100644 index 0000000..6c006a2 Binary files /dev/null and b/2002/problem.build differ diff --git a/2002/problem.set b/2002/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2002/stdin b/2002/stdin new file mode 100644 index 0000000..8664b77 --- /dev/null +++ b/2002/stdin @@ -0,0 +1,6 @@ +1 +1.5 +1.25 +2.4 +3.6 +65535 diff --git a/2002/stdout b/2002/stdout new file mode 100644 index 0000000..3177afa --- /dev/null +++ b/2002/stdout @@ -0,0 +1,6 @@ +4.189 +14.137 +8.181 +57.906 +195.432 +1178985671427752.500 diff --git a/2003/main.c b/2003/main.c new file mode 100644 index 0000000..0b84aa3 --- /dev/null +++ b/2003/main.c @@ -0,0 +1,10 @@ +#include + +int main(void){ + double a = 0.0; + while(scanf("%lf",&a) == 1){ + printf("%.2lf\n",a>0?a:-a); + getchar(); + } + return 0; +} diff --git a/2003/problem.build b/2003/problem.build new file mode 100644 index 0000000..3517c2d Binary files /dev/null and b/2003/problem.build differ diff --git a/2003/problem.set b/2003/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2003/stdin b/2003/stdin new file mode 100644 index 0000000..09f28fd --- /dev/null +++ b/2003/stdin @@ -0,0 +1,2 @@ +123 +-234.00 diff --git a/2003/stdout b/2003/stdout new file mode 100644 index 0000000..dfa1b44 --- /dev/null +++ b/2003/stdout @@ -0,0 +1,2 @@ +123.00 +234.00 diff --git a/2004/main.c b/2004/main.c new file mode 100644 index 0000000..bc25863 --- /dev/null +++ b/2004/main.c @@ -0,0 +1,16 @@ +#include + +int main(void){ + int score = 0; + while(scanf("%d",&score) == 1){ + if(score >= 0 && score <= 100) + if(score >= 90) printf("A\n"); + else if(score >= 80) printf("B\n"); + else if(score >= 70) printf("C\n"); + else if(score >= 60) printf("D\n"); + else printf("E\n"); + else printf("Score is error!\n"); + getchar(); + } + return 0; +} diff --git a/2004/problem.build b/2004/problem.build new file mode 100644 index 0000000..8c9ad14 Binary files /dev/null and b/2004/problem.build differ diff --git a/2004/problem.set b/2004/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2004/std b/2004/std new file mode 100644 index 0000000..e69de29 diff --git a/2004/stdin b/2004/stdin new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/2004/stdin @@ -0,0 +1 @@ +2 diff --git a/2004/stdout b/2004/stdout new file mode 100644 index 0000000..26bede6 --- /dev/null +++ b/2004/stdout @@ -0,0 +1 @@ +1.41421 diff --git a/2005/main.c b/2005/main.c new file mode 100644 index 0000000..a4cb7cb --- /dev/null +++ b/2005/main.c @@ -0,0 +1,24 @@ +#include + +int months[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +int main(void){ + int year = 0, month = 0, day = 0; + int days = 0, i = 0; + while(scanf("%d/%d/%d",&year,&month,&day) == 3){ + days = 0; + for(i = 0; i < month-1; i++){ + days += months[i]; + if(i == 1 && !(year % 4)){ + if(!(year % 100)){ + if(!(year % 400)) days++; + } + else days++; + } + } + days += day; + printf("%d\n",days); + getchar(); + } + return 0; +} diff --git a/2005/problem.build b/2005/problem.build new file mode 100644 index 0000000..0201443 Binary files /dev/null and b/2005/problem.build differ diff --git a/2005/problem.set b/2005/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2005/stdin b/2005/stdin new file mode 100644 index 0000000..35fe3e8 --- /dev/null +++ b/2005/stdin @@ -0,0 +1,4 @@ +1985/1/20 +2006/3/12 +2004/12/31 +2000/12/31 diff --git a/2005/stdout b/2005/stdout new file mode 100644 index 0000000..d682ff2 --- /dev/null +++ b/2005/stdout @@ -0,0 +1,4 @@ +20 +71 +366 +366 diff --git a/2006/main.c b/2006/main.c new file mode 100644 index 0000000..dc0753b --- /dev/null +++ b/2006/main.c @@ -0,0 +1,16 @@ +#include + +int main(void){ + int numbers = 0; + while(scanf("%d",&numbers) == 1){ + int temp = 0, all = 1; + while(temp++ < numbers){ + int n = 0; + scanf("%d",&n); + if(n % 2) all *= n; + } + printf("%d\n",all); + getchar(); + } + return 0; +} diff --git a/2006/problem.build b/2006/problem.build new file mode 100644 index 0000000..4f2618a Binary files /dev/null and b/2006/problem.build differ diff --git a/2006/problem.set b/2006/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2006/stdin b/2006/stdin new file mode 100644 index 0000000..2db78f6 --- /dev/null +++ b/2006/stdin @@ -0,0 +1,2 @@ +3 1 2 3 +4 2 3 4 5 diff --git a/2006/stdout b/2006/stdout new file mode 100644 index 0000000..ec10aa6 --- /dev/null +++ b/2006/stdout @@ -0,0 +1,2 @@ +3 +15 diff --git a/2007/main.c b/2007/main.c new file mode 100644 index 0000000..2f734d4 --- /dev/null +++ b/2007/main.c @@ -0,0 +1,23 @@ +#include +#define TWQ(x) ((x)*(x)) +#define THQ(x) ((x)*(x)*(x)) +#define ABS(x) ((x)>0?(x):(-(x))) + +int main(void){ + int m = 0, n = 0; + while(scanf("%d %d",&m,&n) == 2){ + long o = 0,j = 0; + int i = 0; + if(m > n){ + i = m; + m = n; + n = i; + } + for(i = m ; i <= n; i++) + if(ABS(i) % 2) j += THQ(i); + else o += TWQ(i); + printf("%ld %ld\n",o,j); + getchar(); + } + return 0; +} diff --git a/2007/problem.build b/2007/problem.build new file mode 100644 index 0000000..11f9691 Binary files /dev/null and b/2007/problem.build differ diff --git a/2007/problem.set b/2007/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2007/stdin b/2007/stdin new file mode 100644 index 0000000..f9ef7c0 --- /dev/null +++ b/2007/stdin @@ -0,0 +1,4 @@ +1 3 +2 5 +1 100 +-5 3 diff --git a/2007/stdout b/2007/stdout new file mode 100644 index 0000000..9623b60 --- /dev/null +++ b/2007/stdout @@ -0,0 +1,4 @@ +4 28 +20 152 +171700 12497500 +24 -125 diff --git a/2008/main.c b/2008/main.c new file mode 100644 index 0000000..652775e --- /dev/null +++ b/2008/main.c @@ -0,0 +1,19 @@ +#include + +int main(void){ + int numbers = 0; + while(scanf("%d",&numbers) == 1){ + if(!numbers) continue; + int temp = 0, a = 0, b = 0, c = 0; + double input = 0; + while(temp++ < numbers){ + scanf("%lf",&input); + if(input < 0) a += 1; + else if(input == 0) b += 1; + else c += 1; + } + printf("%d %d %d\n",a,b,c); + getchar(); + } + return 0; +} diff --git a/2008/problem.build b/2008/problem.build new file mode 100644 index 0000000..a5c9e76 Binary files /dev/null and b/2008/problem.build differ diff --git a/2008/problem.set b/2008/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2008/stdin b/2008/stdin new file mode 100644 index 0000000..c65a9c2 --- /dev/null +++ b/2008/stdin @@ -0,0 +1,3 @@ +6 0 1 2 3 -1 0 +5 1 2 3 4 0.5 +0 diff --git a/2008/stdout b/2008/stdout new file mode 100644 index 0000000..2c500fc --- /dev/null +++ b/2008/stdout @@ -0,0 +1,2 @@ +1 2 3 +0 0 5 diff --git a/2009/main.c b/2009/main.c new file mode 100644 index 0000000..7905d26 --- /dev/null +++ b/2009/main.c @@ -0,0 +1,16 @@ +#include +#include +int main(void){ + int n = 0, m = 0; + while(scanf("%d %d",&n,&m) == 2){ + int i = 0; + double all = 0.0, temp = n; + for(i = 0; i < m; i++){ + all += temp; + temp = sqrt(temp); + } + printf("%.2lf\n",all); + getchar(); + } + return 0; +} diff --git a/2009/problem.build b/2009/problem.build new file mode 100644 index 0000000..9a7eca4 Binary files /dev/null and b/2009/problem.build differ diff --git a/2009/problem.set b/2009/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2009/stdin b/2009/stdin new file mode 100644 index 0000000..f422526 --- /dev/null +++ b/2009/stdin @@ -0,0 +1,2 @@ +81 4 +2 2 diff --git a/2009/stdout b/2009/stdout new file mode 100644 index 0000000..d5abae1 --- /dev/null +++ b/2009/stdout @@ -0,0 +1,2 @@ +94.73 +3.41 diff --git a/2010/main.c b/2010/main.c new file mode 100644 index 0000000..743944b --- /dev/null +++ b/2010/main.c @@ -0,0 +1,25 @@ +#include +#define THQ(x) ((x)*(x)*(x)) + +int main(void){ + int m = 0, n = 0; + while(scanf("%d %d",&m,&n) == 2){ + int i = 0, tar[3], j = 0, count = 0, temp = 0; + for(i = m; i <= n; i++){ + temp = i; + for(j = 0; j < 3; j++){ + tar[j] = temp%10; + temp /= 10; + } + if(i == THQ(tar[0]) + THQ(tar[1]) + THQ(tar[2])){ + if(count) printf(" "); + printf("%d",i); + count++; + } + } + if(!count) printf("no\n"); + else printf("\n"); + getchar(); + } + return 0; +} diff --git a/2010/problem.build b/2010/problem.build new file mode 100644 index 0000000..ef674a4 Binary files /dev/null and b/2010/problem.build differ diff --git a/2010/problem.set b/2010/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2010/stdin b/2010/stdin new file mode 100644 index 0000000..20ee319 --- /dev/null +++ b/2010/stdin @@ -0,0 +1,2 @@ +100 120 +300 380 diff --git a/2010/stdout b/2010/stdout new file mode 100644 index 0000000..2b204d3 --- /dev/null +++ b/2010/stdout @@ -0,0 +1,2 @@ +no +370 371 diff --git a/2011/main.c b/2011/main.c new file mode 100644 index 0000000..65e89c0 --- /dev/null +++ b/2011/main.c @@ -0,0 +1,18 @@ +#include + +int main(void){ + int numbers = 0; + scanf("%d",&numbers); + int count = 0, m = 0; + while(count++ < numbers){ + scanf("%d",&m); + int i = 0; + double all = 1.0; + for(i = 2 ; i <= m; i++){ + if(!(i % 2)) all -= 1.0/i; + else all += 1.0/i; + } + printf("%.2lf\n",all); + } + return 0; +} diff --git a/2011/problem.build b/2011/problem.build new file mode 100644 index 0000000..985aa8a Binary files /dev/null and b/2011/problem.build differ diff --git a/2011/problem.set b/2011/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2011/stdin b/2011/stdin new file mode 100644 index 0000000..99e00b5 --- /dev/null +++ b/2011/stdin @@ -0,0 +1,2 @@ +3 +1 2 3 diff --git a/2011/stdout b/2011/stdout new file mode 100644 index 0000000..e920ca2 --- /dev/null +++ b/2011/stdout @@ -0,0 +1,3 @@ +1.00 +0.50 +0.83 diff --git a/2012/main.c b/2012/main.c new file mode 100644 index 0000000..14bc515 --- /dev/null +++ b/2012/main.c @@ -0,0 +1,29 @@ +#include +#include + +int main(void){ + int x = 0, y = 0; + while(scanf("%d %d",&x,&y) == 2){ + int i = 0, temp = 0, j = 0, if_ass = 1; + if(!x && !y) continue; + for(i = x; i <= y; i++){ + int if_ss = 1; + temp = i * i + i + 41; + if(!(temp % 2)) if_ss = 0; + else for(j = 2 ; j <= sqrt(temp); j++){ + if(!(temp % j)){ + if_ss = 0; + break; + } + } + if(!if_ss){ + printf("Sorry\n"); + if_ass = 0; + break; + } + } + if(if_ass) printf("OK\n"); + getchar(); + } + return 0; +} diff --git a/2012/problem.build b/2012/problem.build new file mode 100644 index 0000000..c601d71 Binary files /dev/null and b/2012/problem.build differ diff --git a/2012/problem.set b/2012/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2012/stdin b/2012/stdin new file mode 100644 index 0000000..a1ccb39 --- /dev/null +++ b/2012/stdin @@ -0,0 +1,3 @@ +0 1 +0 0 +-39 12 diff --git a/2012/stdout b/2012/stdout new file mode 100644 index 0000000..2c94e48 --- /dev/null +++ b/2012/stdout @@ -0,0 +1,2 @@ +OK +OK diff --git a/2013/main.c b/2013/main.c new file mode 100644 index 0000000..30fcfb3 --- /dev/null +++ b/2013/main.c @@ -0,0 +1,15 @@ +#include + +int main(void){ + int days = 0; + while(scanf("%d",&days) == 1){ + int i = 0, numbers = 1; + for(i = 1; i < days; i++){ + numbers += 1; + numbers *= 2; + } + printf("%d\n",numbers); + getchar(); + } + return 0; +} diff --git a/2013/problem.build b/2013/problem.build new file mode 100644 index 0000000..c043a29 Binary files /dev/null and b/2013/problem.build differ diff --git a/2013/problem.set b/2013/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2013/stdin b/2013/stdin new file mode 100644 index 0000000..da7f847 --- /dev/null +++ b/2013/stdin @@ -0,0 +1,2 @@ +2 +4 diff --git a/2013/stdout b/2013/stdout new file mode 100644 index 0000000..d942e01 --- /dev/null +++ b/2013/stdout @@ -0,0 +1,2 @@ +4 +22 diff --git a/2014/main.c b/2014/main.c new file mode 100644 index 0000000..c8fa787 --- /dev/null +++ b/2014/main.c @@ -0,0 +1,26 @@ +#include + +int main(void){ + int numbers = 0; + while(scanf("%d",&numbers) == 1){ + int count = 0, temp[120] = {0}, max = 0, min = 0; + double avg = 0.0; + while(count < numbers){ + scanf("%d",&temp[count]); + if(!count){ + max = temp[count]; + min = temp[count]; + } + else{ + if(max < temp[count]) max = temp[count]; + if(min > temp[count]) min = temp[count]; + } + count++; + } + for(count = 0; count < numbers; count++) + if(temp[count] != max && temp[count] != min) avg += (double)temp[count] / (double)(numbers-2); + printf("%.2lf\n",avg); + getchar(); + } + return 0; +} diff --git a/2014/problem.build b/2014/problem.build new file mode 100644 index 0000000..0038fd9 Binary files /dev/null and b/2014/problem.build differ diff --git a/2014/problem.set b/2014/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2014/stdin b/2014/stdin new file mode 100644 index 0000000..ab3e6d9 --- /dev/null +++ b/2014/stdin @@ -0,0 +1,3 @@ +3 99 98 97 +4 100 99 98 97 +10 100 56 78 34 24 23 45 14 12 23 diff --git a/2014/stdout b/2014/stdout new file mode 100644 index 0000000..4ee3f1b --- /dev/null +++ b/2014/stdout @@ -0,0 +1,3 @@ +98.00 +98.50 +37.12 diff --git a/2015/main.c b/2015/main.c new file mode 100644 index 0000000..8d9714e --- /dev/null +++ b/2015/main.c @@ -0,0 +1,31 @@ +#include + +int main(void){ + int n = 0, m = 0; + while(scanf("%d %d",&n,&m) == 2){ + int i = 0, number = 2, count = 1, all = 0, if_print = 0; + for(i = 0; i < n; i++){ + all += number; + count++; + if(count > m){ + if(if_print) printf(" "); + all /= --count; + printf("%d",all); + all = 0; + count = 1; + if_print = 1; + } + number += 2; + } + if(count > 1) + all /= --count; + else all = 0; + if(all != 0) { + if(if_print) printf(" "); + printf("%d",all); + } + printf("\n"); + getchar(); + } + return 0; +} diff --git a/2015/problem.build b/2015/problem.build new file mode 100644 index 0000000..3a5ec8e Binary files /dev/null and b/2015/problem.build differ diff --git a/2015/problem.build.dSYM/Contents/Info.plist b/2015/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/2015/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/2015/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/2015/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..5ca050b Binary files /dev/null and b/2015/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/2015/problem.set b/2015/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2015/stdin b/2015/stdin new file mode 100644 index 0000000..1a1361d --- /dev/null +++ b/2015/stdin @@ -0,0 +1,2 @@ +3 2 +4 2 diff --git a/2015/stdout b/2015/stdout new file mode 100644 index 0000000..014151f --- /dev/null +++ b/2015/stdout @@ -0,0 +1,2 @@ +3 6 +3 7 diff --git a/2016/main.c b/2016/main.c new file mode 100644 index 0000000..c9ca45e --- /dev/null +++ b/2016/main.c @@ -0,0 +1,27 @@ +#include + +int main(void){ + int numbers = 1, ac[100] = {}; + while(scanf("%d",&numbers) == 1){ + if(!numbers) continue; + int i = 0, min = 0, temp = 0, index = 0; + for(i = 0; i < numbers; i++){ + scanf("%d",&ac[i]); + if(!i) min = ac[i]; + else if(min > ac[i]){ + min = ac[i]; + index = i; + } + } + temp = ac[0]; + ac[0] = min; + ac[index] = temp; + for(i = 0; i < numbers; i++){ + if(i) printf(" "); + printf("%d",ac[i]); + } + printf("\n"); + getchar(); + } + return 0; +} diff --git a/2016/problem.build b/2016/problem.build new file mode 100644 index 0000000..6c994c6 Binary files /dev/null and b/2016/problem.build differ diff --git a/2016/problem.set b/2016/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2016/stdin b/2016/stdin new file mode 100644 index 0000000..dcb99d8 --- /dev/null +++ b/2016/stdin @@ -0,0 +1,2 @@ +4 2 1 3 4 +5 5 4 3 2 1 diff --git a/2016/stdout b/2016/stdout new file mode 100644 index 0000000..2338837 --- /dev/null +++ b/2016/stdout @@ -0,0 +1,2 @@ +1 2 3 4 +1 4 3 2 5 diff --git a/2017/main.c b/2017/main.c new file mode 100644 index 0000000..ce0cef3 --- /dev/null +++ b/2017/main.c @@ -0,0 +1,18 @@ +#include + +int main(void){ + long numbers = 0; + scanf("%ld",&numbers); + long i = 0; + char string[1024]; + for(i = 0; i < numbers; i++){ + scanf("%s",string); + long count = 0, temp = 0; + while(string[count] != '\0'){ + if(string[count] > 47 && string[count] < 58) temp++; + count++; + } + printf("%ld\n",temp); + } + return 0; +} diff --git a/2017/problem.build b/2017/problem.build new file mode 100644 index 0000000..c95a6f8 Binary files /dev/null and b/2017/problem.build differ diff --git a/2017/problem.set b/2017/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2017/stdin b/2017/stdin new file mode 100644 index 0000000..b90aafd --- /dev/null +++ b/2017/stdin @@ -0,0 +1,3 @@ +2 +dw345e46fjwfiojwojwiof3242kfw234csoin234 +cw00043cijcwicjweioj34iojvwoivj diff --git a/2017/stdout b/2017/stdout new file mode 100644 index 0000000..39cdd4f --- /dev/null +++ b/2017/stdout @@ -0,0 +1,2 @@ +15 +7 diff --git a/2018/main.c b/2018/main.c new file mode 100644 index 0000000..4b10eb6 --- /dev/null +++ b/2018/main.c @@ -0,0 +1,21 @@ +#include +#define MAX 65535 + +int main(void){ + int numbers = 1; + long temp = 0; + while(scanf("%d",&numbers) == 1){ + if(!numbers) continue; + int i; + long adult = 1,cowsa = 0, cowsb = 0, cowsc = 0; + for(i = 1; i < numbers; i++){ + temp = cowsa; + cowsa = adult; + adult += cowsb; + cowsb = temp; + } + printf("%ld\n",adult + cowsa + cowsb + cowsc); + getchar(); + } + return 0; +} diff --git a/2018/problem.build b/2018/problem.build new file mode 100644 index 0000000..c378d63 Binary files /dev/null and b/2018/problem.build differ diff --git a/2018/problem.build.dSYM/Contents/Info.plist b/2018/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/2018/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/2018/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/2018/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..d34f037 Binary files /dev/null and b/2018/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/2018/problem.set b/2018/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2018/stdin b/2018/stdin new file mode 100644 index 0000000..c170040 --- /dev/null +++ b/2018/stdin @@ -0,0 +1,6 @@ +2 +4 +5 +6 +55 +0 diff --git a/2018/stdout b/2018/stdout new file mode 100644 index 0000000..7d95919 --- /dev/null +++ b/2018/stdout @@ -0,0 +1,5 @@ +2 +4 +6 +9 +1209982081 diff --git a/2019/main.c b/2019/main.c new file mode 100644 index 0000000..9b7091a --- /dev/null +++ b/2019/main.c @@ -0,0 +1,25 @@ +#include + +int main(void){ + int n,m; + int ac[100]; + while(scanf("%d %d",&n,&m) == 2){ + if(!m && !n) continue; + int i, index = 0; + for(i = 0; i < n; i++){ + scanf("%d",&ac[i]); + if(m > ac[i]) index++; + } + if(!index) printf("%d ",m); + for(i = 0; i < n; i++){ + if(i) printf(" "); + printf("%d",ac[i]); + if(i == index-1) { + printf(" %d",m); + } + } + printf("\n"); + getchar(); + } + return 0; +} diff --git a/2019/problem.build b/2019/problem.build new file mode 100644 index 0000000..9ff629d Binary files /dev/null and b/2019/problem.build differ diff --git a/2019/problem.set b/2019/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2019/stdin b/2019/stdin new file mode 100644 index 0000000..eaa356c --- /dev/null +++ b/2019/stdin @@ -0,0 +1,5 @@ +6 11 +2 4 5 7 9 10 +3 5 +3 6 7 +0 0 diff --git a/2019/stdout b/2019/stdout new file mode 100644 index 0000000..d912ec6 --- /dev/null +++ b/2019/stdout @@ -0,0 +1,2 @@ +2 4 5 7 9 10 11 +3 5 6 7 diff --git a/2020/main.c b/2020/main.c new file mode 100644 index 0000000..6922848 --- /dev/null +++ b/2020/main.c @@ -0,0 +1,28 @@ +#include +#define ABS(x) ((x>0)?(x):(-x)) + +int main(void){ + int numbers = 0, ac[100]; + while(scanf("%d",&numbers) == 1){ + if(!numbers) continue; + int i,if_ch = 1,temp; + for(i = 0; i < numbers; i++) scanf("%d",&ac[i]); + while(if_ch){ + if_ch = 0; + for(i = 0; i < numbers - 1; i++){ + if(ABS(ac[i]) < ABS(ac[i+1])){ + temp = ac[i+1]; + ac[i+1] = ac[i]; + ac[i] = temp; + if_ch = 1; + } + } + } + for(i = 0; i < numbers; i++){ + if(i) printf(" "); + printf("%d",ac[i]); + } + printf("\n"); + } + return 0; +} diff --git a/2020/problem.build b/2020/problem.build new file mode 100644 index 0000000..f3dcce0 Binary files /dev/null and b/2020/problem.build differ diff --git a/2020/problem.build.dSYM/Contents/Info.plist b/2020/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/2020/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/2020/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/2020/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..b6a24f1 Binary files /dev/null and b/2020/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/2020/problem.set b/2020/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2020/stdin b/2020/stdin new file mode 100644 index 0000000..64adcec --- /dev/null +++ b/2020/stdin @@ -0,0 +1,3 @@ +3 3 -4 2 +4 0 1 2 -3 +0 diff --git a/2020/stdout b/2020/stdout new file mode 100644 index 0000000..e471eb3 --- /dev/null +++ b/2020/stdout @@ -0,0 +1,2 @@ +-4 3 2 +-3 2 1 0 diff --git a/2021/main.c b/2021/main.c new file mode 100644 index 0000000..e9c7bc9 --- /dev/null +++ b/2021/main.c @@ -0,0 +1,21 @@ +#include + +int rmb[6] = {100, 50, 10, 5, 2, 1}; +int main(void){ + int numbers = 0,ac[100]; + while(scanf("%d",&numbers) == 1){ + if(!numbers) continue; + int temp, i, all = 0, count; + for(i = 0; i < numbers; i++) scanf("%d",&ac[i]); + for(i = 0; i < numbers; i++){ + temp = ac[i]; + for(count = 0; count < 6; count++){ + all += temp / rmb[count]; + temp %= rmb[count]; + } + } + printf("%d\n",all); + getchar(); + } + return 0; +} diff --git a/2021/problem.build b/2021/problem.build new file mode 100644 index 0000000..4a65496 Binary files /dev/null and b/2021/problem.build differ diff --git a/2021/problem.set b/2021/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2021/stdin b/2021/stdin new file mode 100644 index 0000000..a3b0267 --- /dev/null +++ b/2021/stdin @@ -0,0 +1,3 @@ +3 +120 2 3 +0 diff --git a/2021/stdout b/2021/stdout new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/2021/stdout @@ -0,0 +1 @@ +6 diff --git a/2022/main.c b/2022/main.c new file mode 100644 index 0000000..198704c --- /dev/null +++ b/2022/main.c @@ -0,0 +1,23 @@ +#include +#define ABS(x) (((x)>0)?(x):(-x)) + +int main(void){ + int m ,n; + while(scanf("%d %d",&m,&n) == 2){ + int i,j,if_init = 0; + long temp, target; + int t_i = 0, t_j = 0; + for(i = 0 ; i < m; i++) + for(j = 0; j < n; j++){ + scanf("%ld",&temp); + if(!if_init) target = temp, if_init = 1; + else if(ABS(temp) > ABS(target)){ + target = temp; + t_i = i; + t_j = j; + } + } + printf("%d %d %ld\n",t_i+1,t_j+1,target); + } + return 0; +} diff --git a/2022/problem.build b/2022/problem.build new file mode 100644 index 0000000..f650a2e Binary files /dev/null and b/2022/problem.build differ diff --git a/2022/problem.set b/2022/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2022/stdin b/2022/stdin new file mode 100644 index 0000000..6b88fc8 --- /dev/null +++ b/2022/stdin @@ -0,0 +1,3 @@ +2 3 +1 4 -3 +-7 3 0 diff --git a/2022/stdout b/2022/stdout new file mode 100644 index 0000000..c37b850 --- /dev/null +++ b/2022/stdout @@ -0,0 +1 @@ +2 1 -7 diff --git a/2023/main.c b/2023/main.c new file mode 100644 index 0000000..ae9100c --- /dev/null +++ b/2023/main.c @@ -0,0 +1,43 @@ +#include + +int main(void){ + int n, m; + while(scanf("%d %d",&n, &m) == 2){ + int student[50][5] = {0}; + double avg[5] = {0.0}; + int i, j; + for(i = 0; i < n; i++) + for(j = 0; j < m; j++) scanf("%d",&student[i][j]); + for(i = 0; i < n; i++){ + double all = 0.0; + for(j = 0; j < m; j++) all += student[i][j]; + all /= (double) m; + if(i) printf(" "); + printf("%.2lf",all); + } + printf("\n"); + for(i = 0; i < m; i++){ + double all = 0.0; + for(j = 0; j < n; j++) all += student[j][i]; + all /= (double) n; + if(i) printf(" "); + avg[i] = all; + printf("%.2lf",all); + } + printf("\n"); + int good = 0; + for(i = 0; i < n; i++){ + int if_good = 1; + for(j = 0; j < m; j++){ + if(student[i][j] < avg[j]){ + if_good = 0; + break; + } + } + if(if_good) good++; + } + printf("%d\n\n",good); + getchar(); + } + return 0; +} diff --git a/2023/problem.build b/2023/problem.build new file mode 100644 index 0000000..9c49774 Binary files /dev/null and b/2023/problem.build differ diff --git a/2023/problem.set b/2023/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2023/stdin b/2023/stdin new file mode 100644 index 0000000..6bf21eb --- /dev/null +++ b/2023/stdin @@ -0,0 +1,8 @@ +7 7 +9 9 7 9 1 1 3 +2 1 4 4 9 7 1 +6 7 6 5 2 7 6 +9 3 1 1 1 5 1 +4 3 2 1 1 1 1 +6 7 9 9 1 1 1 +7 2 6 4 8 9 1 diff --git a/2023/stdout b/2023/stdout new file mode 100644 index 0000000..375302c --- /dev/null +++ b/2023/stdout @@ -0,0 +1,4 @@ +5.43 4.71 5.43 3.14 3.43 5.86 5.29 +6.14 4.57 5.00 4.71 3.29 6.14 3.43 +0 + diff --git a/2024/main.c b/2024/main.c new file mode 100644 index 0000000..b48b841 --- /dev/null +++ b/2024/main.c @@ -0,0 +1,40 @@ +#include + +int main(void){ + int numbers = 0; + while(scanf("%d",&numbers) == 1){ + int count = 0, i = 0; + for(count = 0; count < numbers; count++){ + char ch, string[51] = {'\0'}; + int if_pass = 1, if_read = 0; + i = 0; + while(if_pass){ + ch = getchar(); + if(!if_read && ch > 32 && ch < 127) if_read = 1; + if(if_read){ + if(ch != '\n') string[i++] = ch; + else if_pass = 0; + } + } + string[i] = '\0'; + i = 0; + int if_true = 1; + if(string[0] != 95){ + if(string[0] < 65 || string[0] > 122) if_true = 0; + else if(string[0] > 90 && string[0] < 97) if_true = 0; + } + while(string[i] != '\0' && if_true){ + if(string[i] != 95){ + if(string[i] < 48) if_true = 0; + else if(string[i] > 57 && string[i] < 65) if_true = 0; + else if(string[i] > 90 && string[i] < 97) if_true = 0; + else if(string[i] > 122) if_true = 0; + } + i++; + } + if(if_true) printf("yes\n"); + else printf("no\n"); + } + } + return 0; +} diff --git a/2024/problem.build b/2024/problem.build new file mode 100644 index 0000000..b69ea34 Binary files /dev/null and b/2024/problem.build differ diff --git a/2024/problem.set b/2024/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2024/stdin b/2024/stdin new file mode 100644 index 0000000..81978d0 --- /dev/null +++ b/2024/stdin @@ -0,0 +1,4 @@ +3 +12ajf +$%^#_A__f#@i8x_a +ffai_2 diff --git a/2024/stdout b/2024/stdout new file mode 100644 index 0000000..f31899c --- /dev/null +++ b/2024/stdout @@ -0,0 +1,3 @@ +no:12ajf +no:$%^#_A__f#@i8x_a +yes:ffai_2 diff --git a/2025/main.c b/2025/main.c new file mode 100644 index 0000000..43ac80d --- /dev/null +++ b/2025/main.c @@ -0,0 +1,20 @@ +#include +#include + +int main(void){ + char string[101]; + while(scanf("%s",string) != EOF){ + char max = '\0'; + int i, numbers = strlen(string); + for(i = 0; i < numbers; i++) + if(string[i] > max) max = string[i]; + + for(i = 0; i < numbers; i++){ + printf("%c",string[i]); + if(string[i] == max) printf("(max)"); + } + printf("\n"); + + } + return 0; +} diff --git a/2025/problem.build b/2025/problem.build new file mode 100644 index 0000000..f99ee17 Binary files /dev/null and b/2025/problem.build differ diff --git a/2025/problem.set b/2025/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2025/stdin b/2025/stdin new file mode 100644 index 0000000..561fd68 --- /dev/null +++ b/2025/stdin @@ -0,0 +1,2 @@ +abcdefgfedcba +xxxxxxx diff --git a/2025/stdout b/2025/stdout new file mode 100644 index 0000000..072efd6 --- /dev/null +++ b/2025/stdout @@ -0,0 +1,2 @@ +abcdefg(max)fedcba +x(max)x(max)x(max)x(max)x(max)x(max)x(max) diff --git a/2026/main.c b/2026/main.c new file mode 100644 index 0000000..fd27fe2 --- /dev/null +++ b/2026/main.c @@ -0,0 +1,18 @@ +#include + +int main(void){ + char word[64], ch; + int if_word = 0, if_work = 1; + while(1){ + ch = getchar(); + if(ch == EOF) break; + else if(ch < 32) if_work = 1; + if(ch > 31){ + if(if_work) ch -= 32, if_work = 0; + if(if_word) ch -= 32, if_word = 0; + if(ch == ' ') if_word = 1; + } + printf("%c",ch); + } + return 0; +} diff --git a/2026/problem.build b/2026/problem.build new file mode 100644 index 0000000..14a86e1 Binary files /dev/null and b/2026/problem.build differ diff --git a/2026/problem.set b/2026/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2026/stdin b/2026/stdin new file mode 100644 index 0000000..03e0be4 --- /dev/null +++ b/2026/stdin @@ -0,0 +1,2 @@ +i like acm +i want to get an accepted diff --git a/2026/stdout b/2026/stdout new file mode 100644 index 0000000..41fa02d --- /dev/null +++ b/2026/stdout @@ -0,0 +1,2 @@ +I Like Acm +I Want To Get An Accepted diff --git a/2027/main.c b/2027/main.c new file mode 100644 index 0000000..9ffedcc --- /dev/null +++ b/2027/main.c @@ -0,0 +1,44 @@ +#include + +int main(void){ + int numbers, count; + scanf("%d\n",&numbers); + for(count = 0; count < numbers; count++){ + int if_read = 1, a = 0, e = 0, i = 0, o = 0, u = 0; + int if_work = 0; + char ch; + while(if_read){ + ch = getchar(); + if(ch > 31 && !if_work) if_work = 1; + if(if_work){ + switch(ch){ + case 'a': + a++; + break; + case 'e': + e++; + break; + case 'i': + i++; + break; + case 'o': + o++; + break; + case 'u': + u++; + break; + default: + break; + } + } + if(ch == '\n') if_read = 0, if_work = 0; + } + if(count) printf("\n"); + printf("a:%d\n",a); + printf("e:%d\n",e); + printf("i:%d\n",i); + printf("o:%d\n",o); + printf("u:%d\n",u); + } + return 0; +} diff --git a/2027/problem.build b/2027/problem.build new file mode 100644 index 0000000..c0182ef Binary files /dev/null and b/2027/problem.build differ diff --git a/2027/problem.set b/2027/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2027/stdin b/2027/stdin new file mode 100644 index 0000000..bf4951c --- /dev/null +++ b/2027/stdin @@ -0,0 +1,3 @@ +2 +aeiou +my name is ignatius diff --git a/2027/stdout b/2027/stdout new file mode 100644 index 0000000..0a69063 --- /dev/null +++ b/2027/stdout @@ -0,0 +1,11 @@ +a:1 +e:1 +i:1 +o:1 +u:1 + +a:2 +e:1 +i:3 +o:0 +u:1 diff --git a/2028/main.c b/2028/main.c new file mode 100644 index 0000000..e1ef6bc --- /dev/null +++ b/2028/main.c @@ -0,0 +1,21 @@ +#include + +int main(void){ + int numbers; + while(scanf("%d",&numbers) == 1){ + int i, number[65535]; + long j, temp; + for(i = 0; i < numbers; i++) scanf("%d",&number[i]); + for(j = 1; j <= 2147483647L; j++){ + temp = j; + int if_ok = 1; + for(i = 0; i < numbers; i++) + if(j % number[i]) if_ok = 0; + if(if_ok){ + printf("%ld\n",j); + break; + } + } + } + return 0; +} diff --git a/2028/problem.build b/2028/problem.build new file mode 100644 index 0000000..2f65fbd Binary files /dev/null and b/2028/problem.build differ diff --git a/2028/problem.set b/2028/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2028/stdin b/2028/stdin new file mode 100644 index 0000000..7b6705f --- /dev/null +++ b/2028/stdin @@ -0,0 +1,2 @@ +2 4 6 +3 2 5 7 diff --git a/2028/stdout b/2028/stdout new file mode 100644 index 0000000..93c6b67 --- /dev/null +++ b/2028/stdout @@ -0,0 +1,2 @@ +12 +70 diff --git a/2029/main.c b/2029/main.c new file mode 100644 index 0000000..d612778 --- /dev/null +++ b/2029/main.c @@ -0,0 +1,18 @@ +#include +#include + +int main(void){ + int numbers = 0; + scanf("%d",&numbers); + int i,j; + char string[65535], a_string[65535]; + for(i = 0; i < numbers; i++){ + scanf("%s",string); + int len = strlen(string); + for(j = 0; j < len; j++) a_string[len - (j+1)] = string[j]; + a_string[len] = '\0'; + if(!strcmp(string,a_string)) printf("yes\n"); + else printf("no\n"); + } + return 0; +} diff --git a/2029/problem.build b/2029/problem.build new file mode 100644 index 0000000..752f233 Binary files /dev/null and b/2029/problem.build differ diff --git a/2029/problem.set b/2029/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2029/stdin b/2029/stdin new file mode 100644 index 0000000..5edf577 --- /dev/null +++ b/2029/stdin @@ -0,0 +1,17 @@ +4 +level +abcde +noon +haha4 +level +abcde +noon +haha4 +level +abcde +noon +haha4 +level +abcde +noon +haha diff --git a/2029/stdout b/2029/stdout new file mode 100644 index 0000000..33cc71c --- /dev/null +++ b/2029/stdout @@ -0,0 +1,4 @@ +yes +no +yes +no diff --git a/2030/main.c b/2030/main.c new file mode 100644 index 0000000..31c4408 --- /dev/null +++ b/2030/main.c @@ -0,0 +1,21 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i; + for(i = 0; i < numbers; i++){ + int ch, string[65535]; + int if_read = 0, j = 0; + while(1){ + ch = getchar(); + if(ch > 32 && !if_read) if_read = 1, j = 0; + if(if_read){ + if(ch > 122) j++; + if(ch == '\n') break; + } + } + printf("%d\n",j/3); + } + return 0; +} diff --git a/2030/problem.build b/2030/problem.build new file mode 100644 index 0000000..5ec6c40 Binary files /dev/null and b/2030/problem.build differ diff --git a/2030/problem.set b/2030/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2030/stdin b/2030/stdin new file mode 100644 index 0000000..c612051 --- /dev/null +++ b/2030/stdin @@ -0,0 +1,3 @@ +2 +你好呀w +你好 diff --git a/2030/stdout b/2030/stdout new file mode 100644 index 0000000..9adf752 --- /dev/null +++ b/2030/stdout @@ -0,0 +1,2 @@ +228 189 160 229 165 189 229 145 128 119 10 3 +228 189 160 229 165 189 10 2 diff --git a/2032/main.c b/2032/main.c new file mode 100644 index 0000000..69b091d --- /dev/null +++ b/2032/main.c @@ -0,0 +1,31 @@ +#include + +unsigned long long c(int f_n, int l_n); + +int main(void){ + int numbers, if_first = 1; + while(scanf("%d",&numbers) != EOF){ + int i,j; + if(if_first) if_first = 0; + else printf("\n"); + for(i = 0; i < numbers; i++){ + for(j = 0; j <= i; j++){ + if(j) printf(" "); + printf("%lld",c(j,i)); + } + printf("\n"); + } + } + printf("\n"); + return 0; +} + +unsigned long long c(int f_n, int l_n){ + unsigned long long res = 1; + int i; + if(f_n * 2 > l_n) f_n = l_n - f_n; + if(!f_n) return 1; + for(i = 0; i < f_n; i++) res *= l_n - i; + for(i = 1; i <= f_n; i++) res /= i; + return res; +} diff --git a/2032/problem.build b/2032/problem.build new file mode 100644 index 0000000..e1f629b Binary files /dev/null and b/2032/problem.build differ diff --git a/2032/problem.set b/2032/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2032/stdin b/2032/stdin new file mode 100644 index 0000000..3c2bb02 --- /dev/null +++ b/2032/stdin @@ -0,0 +1 @@ +3 4 5 6 diff --git a/2032/stdout b/2032/stdout new file mode 100644 index 0000000..71b294e --- /dev/null +++ b/2032/stdout @@ -0,0 +1,22 @@ +1 +1 1 +1 2 1 + +1 +1 1 +1 2 1 +1 3 3 1 + +1 +1 1 +1 2 1 +1 3 3 1 +1 4 6 4 1 + +1 +1 1 +1 2 1 +1 3 3 1 +1 4 6 4 1 +1 5 10 10 5 1 + diff --git a/2033/main.c b/2033/main.c new file mode 100644 index 0000000..974174b --- /dev/null +++ b/2033/main.c @@ -0,0 +1,21 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i; + for(i = 0; i < numbers; i++){ + int ah, am, as, bh, bm, bs; + scanf("%d %d %d %d %d %d",&ah,&am,&as,&bh,&bm,&bs); + int cm, ch, cs; + cs = as + bs; + cm = cs / 60; + cs %= 60; + cm += am + bm; + ch = cm / 60; + cm %= 60; + ch += ah + bh; + printf("%d %d %d\n",ch,cm,cs); + } + return 0; +} diff --git a/2033/problem.build b/2033/problem.build new file mode 100644 index 0000000..1b37d80 Binary files /dev/null and b/2033/problem.build differ diff --git a/2033/problem.set b/2033/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2033/stdin b/2033/stdin new file mode 100644 index 0000000..f172082 --- /dev/null +++ b/2033/stdin @@ -0,0 +1,3 @@ +2 +1 2 3 4 5 6 +34 45 56 12 23 34 diff --git a/2033/stdout b/2033/stdout new file mode 100644 index 0000000..9da87a0 --- /dev/null +++ b/2033/stdout @@ -0,0 +1,2 @@ +5 7 9 +47 9 30 diff --git a/2034/2035/main.c b/2034/2035/main.c new file mode 100644 index 0000000..b1df20c --- /dev/null +++ b/2034/2035/main.c @@ -0,0 +1,16 @@ +#include + +int main(void){ + int a, b, c = 1000, t = 1; + a = a % c; + while(scanf("%d %d",&a,&b) == 2 && a+b){ + t = 1; + while(b != 0){ + if(b & 1) t = t * a % c; + b >>= 1; + a = a * a % c; + } + printf("%d\n",t); + } + return 0; +} diff --git a/2034/2035/problem.build b/2034/2035/problem.build new file mode 100644 index 0000000..85440bb Binary files /dev/null and b/2034/2035/problem.build differ diff --git a/2034/2035/problem.set b/2034/2035/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2034/2035/stdin b/2034/2035/stdin new file mode 100644 index 0000000..2abe2e4 --- /dev/null +++ b/2034/2035/stdin @@ -0,0 +1,4 @@ +2 3 +12 6 +6789 10000 +0 0 diff --git a/2034/2035/stdout b/2034/2035/stdout new file mode 100644 index 0000000..bf7b4f1 --- /dev/null +++ b/2034/2035/stdout @@ -0,0 +1,6 @@ +2 3 +8 +12 6 +984 +6789 10000 +1 diff --git a/2034/main.c b/2034/main.c new file mode 100644 index 0000000..ee716bd --- /dev/null +++ b/2034/main.c @@ -0,0 +1,40 @@ +#include + +int main(void){ + int n, m, a[110] = {0}, b[110] = {0},c[110] = {0}; + while(scanf("%d %d",&n,&m) != EOF){ + if(!m && !n) continue; + int i; + for(i = 0; i < n; i++) scanf("%d",&a[i]); + for(i = 0; i < m; i++) scanf("%d",&b[i]); + int j,count = 0; + for(i = 0; i < n; i++){ + int if_in = 0; + for(j = 0; j < m; j++) + if(a[i] == b[j]){ + if_in = 1; + break; + } + if(!if_in) c[count++] = a[i]; + } + int if_change = 1, temp; + while(if_change && count > 1){ + if_change = 0; + for(i = 0; i < count - 1; i++){ + if(c[i] > c[i+1]){ + temp = c[i]; + c[i] = c[i+1]; + c[i+1] = temp; + if_change = 1; + } + } + } + if(count) + for(i = 0; i < count; i++){ + printf("%d ",c[i]); + } + else printf("NULL"); + printf("\n"); + } + return 0; +} diff --git a/2034/problem.build b/2034/problem.build new file mode 100644 index 0000000..c5e57ec Binary files /dev/null and b/2034/problem.build differ diff --git a/2034/problem.build.dSYM/Contents/Info.plist b/2034/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/2034/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/2034/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/2034/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..ec56ad4 Binary files /dev/null and b/2034/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/2034/problem.set b/2034/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2034/stdin b/2034/stdin new file mode 100644 index 0000000..5f342f4 --- /dev/null +++ b/2034/stdin @@ -0,0 +1 @@ +15 0 4 5 65 36 5 64 3 2 61 73 63 17 32 6 87 diff --git a/2034/stdout b/2034/stdout new file mode 100644 index 0000000..3764898 --- /dev/null +++ b/2034/stdout @@ -0,0 +1 @@ +4 5 36 5 64 3 2 61 65 63 17 32 6 73 87 diff --git a/2040/main.c b/2040/main.c new file mode 100644 index 0000000..1ef89e6 --- /dev/null +++ b/2040/main.c @@ -0,0 +1,20 @@ +#include + +int main(void){ + int numbers, i, count; + scanf("%d",&numbers); + long a, b; + for(count = 0; count < numbers; count++){ + scanf("%ld %ld",&a,&b); + long sum = 0; + int if_yes = 0; + for(i = 1; i < a; i++) + if(!(a % i)) sum += i; + if(sum == b) if_yes = 1; + for(i = 1, sum = 0; i < b; i++) + if(!(b % i)) sum += i; + if(sum == a && if_yes) printf("YES\n"); + else printf("NO\n"); + } + return 0; +} diff --git a/2040/problem.build b/2040/problem.build new file mode 100644 index 0000000..e220b57 Binary files /dev/null and b/2040/problem.build differ diff --git a/2040/problem.set b/2040/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2040/stdin b/2040/stdin new file mode 100644 index 0000000..5d2089f --- /dev/null +++ b/2040/stdin @@ -0,0 +1,3 @@ +2 +220 284 +100 200 diff --git a/2040/stdout b/2040/stdout new file mode 100644 index 0000000..823d3f6 --- /dev/null +++ b/2040/stdout @@ -0,0 +1,2 @@ +YES +NO diff --git a/2042/main.c b/2042/main.c new file mode 100644 index 0000000..a387d2c --- /dev/null +++ b/2042/main.c @@ -0,0 +1,15 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int count, i, station, all; + for(count = 0; count < numbers; count++){ + scanf("%d",&station); + all = 3; + for(i = 0; i < station; i++) + all = (all - 1) * 2; + printf("%d\n",all); + } + return 0; +} diff --git a/2042/problem.build b/2042/problem.build new file mode 100644 index 0000000..802c0f7 Binary files /dev/null and b/2042/problem.build differ diff --git a/2042/problem.set b/2042/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2042/stdin b/2042/stdin new file mode 100644 index 0000000..5357a4a --- /dev/null +++ b/2042/stdin @@ -0,0 +1,3 @@ +2 +1 +2 diff --git a/2042/stdout b/2042/stdout new file mode 100644 index 0000000..cfbeb15 --- /dev/null +++ b/2042/stdout @@ -0,0 +1,2 @@ +4 +6 diff --git a/2043/main.c b/2043/main.c new file mode 100644 index 0000000..bc23ea3 --- /dev/null +++ b/2043/main.c @@ -0,0 +1,37 @@ +#include +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int count, i; + char ch, string[50]; + for(count = 0; count < numbers; count++){ + scanf("%s",string); + int len = strlen(string); + int if_one = 0, if_a = 0, if_b = 0, if_c = 0, if_d = 0, temp = if_one, if_ok = 1; + if(len >=8 && len <= 16){ + i = 0; + while(string[i] != '\0'){ + temp = if_one; + if(string[i] >= 'A' && string[i] <= 'Z') if_one++, if_a = 1; + else if(string[i] >= 'a' && string[i] <= 'z') if_one++, if_b = 1; + else if(string[i] >= '0' && string[i] <= '9') if_one++, if_c = 1; + if(string[i] == '~' || string[i] == '@' || string[i] == '#' || string[i] == '!') + if_one++, if_d = 1; + if(string[i] == '$' || string[i] == '%' || string[i] == '^') + if_one++, if_d = 1; + if(if_one == temp){ + printf("NO\n"); + if_ok = 0; + break; + } + i++; + } + if(if_ok && if_a + if_b + if_c + if_d >= 3)printf("YES\n"); + else printf("NO\n"); + } + else printf("NO\n"); + } + return 0; +} diff --git a/2043/problem.build b/2043/problem.build new file mode 100644 index 0000000..89d01a2 Binary files /dev/null and b/2043/problem.build differ diff --git a/2043/problem.build.dSYM/Contents/Info.plist b/2043/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/2043/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/2043/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/2043/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..889b3ee Binary files /dev/null and b/2043/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/2043/problem.set b/2043/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2043/stdin b/2043/stdin new file mode 100644 index 0000000..18c1711 --- /dev/null +++ b/2043/stdin @@ -0,0 +1,4 @@ +3 +a1b2c3d4 +Linle@ACM +^~^@^@!% diff --git a/2043/stdout b/2043/stdout new file mode 100644 index 0000000..9b18c89 --- /dev/null +++ b/2043/stdout @@ -0,0 +1,3 @@ +NO +YES +NO diff --git a/2044/main.c b/2044/main.c new file mode 100644 index 0000000..a41ad63 --- /dev/null +++ b/2044/main.c @@ -0,0 +1,21 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int count,a,b; + for(count = 0;count < numbers; count++){ + scanf("%d %d",&a,&b); + unsigned long long step[50] = {1,2}; + b = b - a; + if(b > 2){ + for(a = 2; a < b; a++){ + step[a] = step[a-1] +step[a-2]; + } + } + if(b > 0) + printf("%lld\n",step[b-1]); + else printf("1\n"); + } + return 0; +} diff --git a/2044/problem.build b/2044/problem.build new file mode 100644 index 0000000..84ac4c4 Binary files /dev/null and b/2044/problem.build differ diff --git a/2044/problem.set b/2044/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2044/stdin b/2044/stdin new file mode 100644 index 0000000..18b2e6b --- /dev/null +++ b/2044/stdin @@ -0,0 +1,3 @@ +2 +4 5 +1 50 diff --git a/2044/stdout b/2044/stdout new file mode 100644 index 0000000..2dfe1fa --- /dev/null +++ b/2044/stdout @@ -0,0 +1,2 @@ +1 +12586269025 diff --git a/2045-i/main.c b/2045-i/main.c new file mode 100644 index 0000000..df9fd80 --- /dev/null +++ b/2045-i/main.c @@ -0,0 +1,14 @@ +#include +int main(){ + int m; + double ans[51]; + ans[1] = 3; + ans[2] = 6; + ans[3] = 6; + for(int i=4;i<51;i++){ + ans[i] = ans[i-1] + 2*ans[i-2]; + } + while(scanf("%d", &m)!=EOF){ + printf("%.0lf\n", ans[m]); + } +} diff --git a/2045-i/problem.build b/2045-i/problem.build new file mode 100644 index 0000000..ff29148 Binary files /dev/null and b/2045-i/problem.build differ diff --git a/2045-i/problem.set b/2045-i/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2045-i/stdin b/2045-i/stdin new file mode 100644 index 0000000..ca71483 --- /dev/null +++ b/2045-i/stdin @@ -0,0 +1,8 @@ +2 +1 +3 +4 +5 +6 +7 +50 diff --git a/2045-i/stdout b/2045-i/stdout new file mode 100644 index 0000000..68cb6fc --- /dev/null +++ b/2045-i/stdout @@ -0,0 +1,8 @@ +6 +3 +6 +18 +30 +66 +126 +1125899906842626 diff --git a/2045/main.c b/2045/main.c new file mode 100644 index 0000000..4b07db2 --- /dev/null +++ b/2045/main.c @@ -0,0 +1,20 @@ +#include + +int main(void){ + int numbers,i; + unsigned long long n[50] = {3}; + unsigned long long count = 2, cut = 0; + for(i = 1; i < 50; i++){ + cut = count - cut; + count *= 2; + n[i-1] = cut*3; + } + while(scanf("%d",&numbers) == 1){ + if(numbers == 1){ + printf("3\n"); + continue; + } + printf("%llu\n",n[numbers-2]); + } + return 0; +} diff --git a/2045/problem.build b/2045/problem.build new file mode 100644 index 0000000..05e8939 Binary files /dev/null and b/2045/problem.build differ diff --git a/2045/problem.set b/2045/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2045/stdin b/2045/stdin new file mode 100644 index 0000000..0c9af78 --- /dev/null +++ b/2045/stdin @@ -0,0 +1,7 @@ +2 +1 +3 +4 +5 +6 +50 diff --git a/2045/stdout b/2045/stdout new file mode 100644 index 0000000..16b161c --- /dev/null +++ b/2045/stdout @@ -0,0 +1,7 @@ +6 +3 +6 +18 +30 +66 +1125899906842626 diff --git a/2046/main.c b/2046/main.c new file mode 100644 index 0000000..d8351dc --- /dev/null +++ b/2046/main.c @@ -0,0 +1,13 @@ +#include + +int main(void){ + int count, i; + unsigned long long n[50] = {1,2}; + for(i = 2; i < 50; i++){ + n[i] = n[i-2] + n[i-1]; + } + while(scanf("%d",&count) == 1){ + printf("%lld\n",n[count-1]); + } + return 0; +} diff --git a/2046/problem.build b/2046/problem.build new file mode 100644 index 0000000..c44e7ad Binary files /dev/null and b/2046/problem.build differ diff --git a/2046/problem.set b/2046/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2046/stdin b/2046/stdin new file mode 100644 index 0000000..ffa5d5e --- /dev/null +++ b/2046/stdin @@ -0,0 +1,5 @@ +1 +2 +3 +4 +50 diff --git a/2046/stdout b/2046/stdout new file mode 100644 index 0000000..ad857ba --- /dev/null +++ b/2046/stdout @@ -0,0 +1,5 @@ +1 +2 +3 +5 +20365011074 diff --git a/2047/main.c b/2047/main.c new file mode 100644 index 0000000..9b35c7d --- /dev/null +++ b/2047/main.c @@ -0,0 +1,18 @@ +#include + +int main(void){ + int count,i; + unsigned long long n[3][40]={0}; + n[0][0] = 1, n[1][0] = 1, n[2][0] = 1; + n[0][1] = 3, n[1][1] = 2, n[2][1] = 3; + for(i = 2; i < 40; i++){ + n[0][i] = n[0][i-1] + n[1][i-1] + n[2][i-1]; + n[1][i] = n[0][i-1] + n[2][i-1]; + n[2][i] = n[0][i-1] + n[1][i-1] + n[2][i-1]; + } + while(scanf("%d",&count) == 1){ + printf("%llu\n",n[0][count-1]+n[1][count-1]+n[2][count-1]); + } + + return 0; +} diff --git a/2047/problem.build b/2047/problem.build new file mode 100644 index 0000000..e90b779 Binary files /dev/null and b/2047/problem.build differ diff --git a/2047/problem.set b/2047/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2047/stdin b/2047/stdin new file mode 100644 index 0000000..01e79c3 --- /dev/null +++ b/2047/stdin @@ -0,0 +1,3 @@ +1 +2 +3 diff --git a/2047/stdout b/2047/stdout new file mode 100644 index 0000000..5fa5dd2 --- /dev/null +++ b/2047/stdout @@ -0,0 +1,3 @@ +3 +8 +22 diff --git a/2048-i/main.c b/2048-i/main.c new file mode 100644 index 0000000..cba498f --- /dev/null +++ b/2048-i/main.c @@ -0,0 +1,2 @@ +#include +unsigned long long f[21],sum;int main(){int i,t,n;f[1]=0;f[2]=1;for(i=3;i<21;i++)f[i]=(i-1)*(f[i-1]+f[i-2]);scanf("%d",&t);while(t--){scanf("%d",&n);sum=1;for(i=1;i<=n;i++)sum*=i;printf("%.2lf%%\n",f[n]*100.0/sum);}return 0;} diff --git a/2048-i/problem.build b/2048-i/problem.build new file mode 100644 index 0000000..fffbfb1 Binary files /dev/null and b/2048-i/problem.build differ diff --git a/2048-i/problem.set b/2048-i/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2048-i/stdin b/2048-i/stdin new file mode 100644 index 0000000..f844cb0 --- /dev/null +++ b/2048-i/stdin @@ -0,0 +1,5 @@ +4 +2 +3 +4 +5 diff --git a/2048-i/stdout b/2048-i/stdout new file mode 100644 index 0000000..daf2c5e --- /dev/null +++ b/2048-i/stdout @@ -0,0 +1,4 @@ +50.00% +33.33% +37.50% +36.79% diff --git a/2048/main.c b/2048/main.c new file mode 100644 index 0000000..e21f267 --- /dev/null +++ b/2048/main.c @@ -0,0 +1,17 @@ +#include + +int main(void){ + int i; + double p[20] = {0,1,1.0/2.0,2.0/3},p1[20] = {0,0,1.0/2.0}; + for(i = 4; i <= 20; i++){ + p1[i-1] = ((1.0/(i-1)) * p[i-2]) + (((double)(i-2)/(i-1)) * p1[i-2]); + p[i] = (1.0/i) + p1[i-1] * ((double)(i-1)/i); + } + int numbers,temp; + scanf("%d",&numbers); + for(i = 0; i< numbers; i++){ + scanf("%d",&temp); + printf("%.2lf%%\n",(1.0-p[temp])*100); + } + return 0; +} diff --git a/2048/problem.build b/2048/problem.build new file mode 100644 index 0000000..e162537 Binary files /dev/null and b/2048/problem.build differ diff --git a/2048/problem.set b/2048/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2048/stdin b/2048/stdin new file mode 100644 index 0000000..14a7b87 --- /dev/null +++ b/2048/stdin @@ -0,0 +1,4 @@ +3 +2 +3 +9 diff --git a/2048/stdout b/2048/stdout new file mode 100644 index 0000000..f8d40eb --- /dev/null +++ b/2048/stdout @@ -0,0 +1,3 @@ +50.00% +33.33% +36.79% diff --git a/2049-i/main.c b/2049-i/main.c new file mode 100644 index 0000000..da32dd8 --- /dev/null +++ b/2049-i/main.c @@ -0,0 +1,21 @@ +#include +unsigned long long sum[21],f[21]; +int main() +{ + int i,t,n,m; + f[0]=0;f[1]=0;f[2]=1; + sum[0]=1;sum[1]=1; + for(i=2;i<=20;i++) + { + sum[i]=sum[i-1]*i; + if(i>=3) + f[i]=(i-1)*(f[i-1]+f[i-2]); + } + scanf("%d",&t); + while(t--) + { + scanf("%d%d",&n,&m); + printf("%llu\n",sum[n]/sum[m]/sum[n-m]*f[m]); + } + return 0; +} diff --git a/2049-i/problem.build b/2049-i/problem.build new file mode 100644 index 0000000..49f7ef3 Binary files /dev/null and b/2049-i/problem.build differ diff --git a/2049-i/problem.set b/2049-i/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2049-i/stdin b/2049-i/stdin new file mode 100644 index 0000000..c935501 --- /dev/null +++ b/2049-i/stdin @@ -0,0 +1,3 @@ +2 +2 1 +10 6 diff --git a/2049-i/stdout b/2049-i/stdout new file mode 100644 index 0000000..723a3e0 --- /dev/null +++ b/2049-i/stdout @@ -0,0 +1,2 @@ +0 +55650 diff --git a/2049/main.c b/2049/main.c new file mode 100644 index 0000000..b223555 --- /dev/null +++ b/2049/main.c @@ -0,0 +1,30 @@ +#include + +unsigned long long c(int n, int m); + +int main(void){ + unsigned long long q[21]={0,0,1,2},q2[21]={0,0,1},temp = 1; + int i; + for(i = 4; i <= 20; i++){ + q2[i-1] = q[i-2] + (i-2) * q2[i-2]; + q[i] = (i-1) * q2[i-1]; + } + int numbers,m,n; + scanf("%d",&numbers); + for(i = 0; i < numbers; i++){ + scanf("%d %d",&n,&m); + printf("%llu\n",c(n,m) * q[m]); + } + return 0; +} + +unsigned long long c(int n, int m){ + int i = 0; + unsigned long long temp = 1, temp2 = 1; + if(m > n/2) m = n-m; + for(i = 0; i < m; i++){ + temp *= n-i; + temp2 *= i+1; + } + return temp/temp2; +} diff --git a/2049/problem.build b/2049/problem.build new file mode 100644 index 0000000..0593287 Binary files /dev/null and b/2049/problem.build differ diff --git a/2049/problem.set b/2049/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2049/stdin b/2049/stdin new file mode 100644 index 0000000..c935501 --- /dev/null +++ b/2049/stdin @@ -0,0 +1,3 @@ +2 +2 1 +10 6 diff --git a/2049/stdout b/2049/stdout new file mode 100644 index 0000000..723a3e0 --- /dev/null +++ b/2049/stdout @@ -0,0 +1,2 @@ +0 +55650 diff --git a/2050/main.c b/2050/main.c new file mode 100644 index 0000000..8b23ae6 --- /dev/null +++ b/2050/main.c @@ -0,0 +1,15 @@ +#include + +int main(void){ + int input; + while(scanf("%d", &input) == 1){ + int output[10] = {0},count = 0; + while(input > 0){ + output[count++] = input % 2; + input /= 2; + } + for(input = count-1; input >=0; input--) printf("%d",output[input]); + printf("\n"); + } + return 0; +} diff --git a/2050/problem.build b/2050/problem.build new file mode 100644 index 0000000..c6bf9ae Binary files /dev/null and b/2050/problem.build differ diff --git a/2050/problem.set b/2050/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2050/stdin b/2050/stdin new file mode 100644 index 0000000..5953577 --- /dev/null +++ b/2050/stdin @@ -0,0 +1,3 @@ +3 +1 +5 diff --git a/2050/stdout b/2050/stdout new file mode 100644 index 0000000..68266cc --- /dev/null +++ b/2050/stdout @@ -0,0 +1,3 @@ +11 +1 +101 diff --git a/2051/main.c b/2051/main.c new file mode 100644 index 0000000..c058f67 --- /dev/null +++ b/2051/main.c @@ -0,0 +1,20 @@ +#include + +int main(void){ + int x,y; + while(scanf("%d %d",&x,&y) == 2){ + int i,k; + for(i = 0; i <= y+1; i++){ + for(k = 0; k <= x+1; k++){ + if((!i && !k) || (i == y+1 && k == x+1)) printf("+"); + else if((!i && k == x+1) ||(!k && i == y+1)) printf("+"); + else if(!i || i == y+1) printf("-"); + else if(!k || k == x+1) printf("|"); + else printf(" "); + } + printf("\n"); + } + printf("\n"); + } + return 0; +} diff --git a/2051/problem.build b/2051/problem.build new file mode 100644 index 0000000..12d9277 Binary files /dev/null and b/2051/problem.build differ diff --git a/2051/problem.set b/2051/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2051/stdin b/2051/stdin new file mode 100644 index 0000000..ebcee1a --- /dev/null +++ b/2051/stdin @@ -0,0 +1 @@ +3 4 diff --git a/2051/stdout b/2051/stdout new file mode 100644 index 0000000..c339280 --- /dev/null +++ b/2051/stdout @@ -0,0 +1,6 @@ ++---+ +| | +| | +| | +| | ++---+ diff --git a/2052/main.c b/2052/main.c new file mode 100644 index 0000000..a69bec3 --- /dev/null +++ b/2052/main.c @@ -0,0 +1,13 @@ +#include + +int main(void){ + long th,i; + while(scanf("%ld",&th) == 1){ + int state = 0; + for(i = 1; i <= th; i++){ + if(!(th % i)) state = !state; + } + printf("%d\n",state); + } + return 0; +} diff --git a/2052/problem.build b/2052/problem.build new file mode 100644 index 0000000..6b108dd Binary files /dev/null and b/2052/problem.build differ diff --git a/2052/problem.set b/2052/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2052/stdin b/2052/stdin new file mode 100644 index 0000000..26b37d0 --- /dev/null +++ b/2052/stdin @@ -0,0 +1,2 @@ +1 +5 diff --git a/2052/stdout b/2052/stdout new file mode 100644 index 0000000..b261da1 --- /dev/null +++ b/2052/stdout @@ -0,0 +1,2 @@ +1 +0 diff --git a/2053/main.c b/2053/main.c new file mode 100644 index 0000000..f46e213 --- /dev/null +++ b/2053/main.c @@ -0,0 +1,24 @@ +#include +#include + +char a[409600],b[409600]; +int todo(char *t); + +int main(void){ + while(scanf("%s %s",a,b) == 2){ + todo(a),todo(b); + !strcmp(a,b)?printf("YES\n"):printf("NO\n"); + } + return 0; +} + +int todo(char *t){ + long len = strlen(t), count = len-1; + if(strchr(t,'.') != NULL) + while(t[count] == '0'){ + t[count] = '\0'; + count--; + } + if (t[count] == '.') t[count] = '\0'; + return 0; +} diff --git a/2053/problem.build b/2053/problem.build new file mode 100644 index 0000000..9c09af1 Binary files /dev/null and b/2053/problem.build differ diff --git a/2053/problem.set b/2053/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2053/stdin b/2053/stdin new file mode 100644 index 0000000..88ee974 --- /dev/null +++ b/2053/stdin @@ -0,0 +1,3 @@ +3 3 +2.0300 2.03 +4 5 diff --git a/2053/stdout b/2053/stdout new file mode 100644 index 0000000..5ae1e3d --- /dev/null +++ b/2053/stdout @@ -0,0 +1,3 @@ +YES +YES +NO diff --git a/2055/main.c b/2055/main.c new file mode 100644 index 0000000..84f6c73 --- /dev/null +++ b/2055/main.c @@ -0,0 +1,18 @@ +#include + +int main(void){ + int numbers,i; + scanf("%d",&numbers); + for(i = 0; i < numbers; i++){ + char ch[2]; + int y; + scanf("%s %d",ch,&y); + if(ch[0] >= 'A' && ch[0] <= 'Z'){ + printf("%d\n",ch[0]-64+y); + } + else{ + printf("%d\n",(-ch[0])+96+y); + } + } + return 0; +} diff --git a/2055/problem.build b/2055/problem.build new file mode 100644 index 0000000..f36a0e2 Binary files /dev/null and b/2055/problem.build differ diff --git a/2055/problem.set b/2055/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2055/stdin b/2055/stdin new file mode 100644 index 0000000..2580b96 --- /dev/null +++ b/2055/stdin @@ -0,0 +1,7 @@ +6 +R 1 +P 2 +G 3 +r 1 +p 2 +g 3 diff --git a/2055/stdout b/2055/stdout new file mode 100644 index 0000000..450ca6d --- /dev/null +++ b/2055/stdout @@ -0,0 +1,6 @@ +19 +18 +10 +-17 +-14 +-4 diff --git a/2056-i/main.c b/2056-i/main.c new file mode 100644 index 0000000..7d05dfd --- /dev/null +++ b/2056-i/main.c @@ -0,0 +1,30 @@ +#include +double max(double a,double b) //求两者中大的 +{ + return a>b?a:b; +} +double min(double c,double d) //求两者中小的 +{ + return cx2) t=x1,x1=x2,x2=t;// 保证x2>x1。符合图中的情况。 + if(y1>y2) t=y1,y1=y2,y2=t;//同上 + if(x3>x4) t=x3,x3=x4,x4=t;//同上 + if(y3>y4) t=y3,y3=y4,y4=t;//同上 + double l=min(x2,x4)-max(x1,x3);// 求宽 + double d=min(y2,y4)-max(y1,y3);// 求高。 + double s=l*d; //求面积。 + printf("%.2lf\n",max(x1,x3)>min(x2,x4)||max(y1,y3)>min(y2,y4)?0:s);//如果高或宽小于0解为0,即没有相交的部分,否则输出面积 + } +} +int main() +{ + solve();//问题解决。 + return 0; +} + diff --git a/2056-i/problem.build b/2056-i/problem.build new file mode 100644 index 0000000..c983b3b Binary files /dev/null and b/2056-i/problem.build differ diff --git a/2056-i/problem.set b/2056-i/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2056-i/stdin b/2056-i/stdin new file mode 100644 index 0000000..88720ce --- /dev/null +++ b/2056-i/stdin @@ -0,0 +1,3 @@ +1.00 1.00 3.00 3.00 2.00 2.00 4.00 4.00 +5.00 5.00 13.00 13.00 4.00 4.00 12.50 12.50 +0.0 9.28 -1.0 -9.674 -2.3324 10.43 5.435 4.0 diff --git a/2056-i/stdout b/2056-i/stdout new file mode 100644 index 0000000..d6612ac --- /dev/null +++ b/2056-i/stdout @@ -0,0 +1,3 @@ +1.00 +56.25 +5.28 diff --git a/2056/main.c b/2056/main.c new file mode 100644 index 0000000..14f8a2f --- /dev/null +++ b/2056/main.c @@ -0,0 +1,64 @@ +#include +#define ABS(x) (((x)>0)?(x):(-(x))) + +struct point{ + double x,y; +}; + +struct retangle{ + struct point p1,p2; +}; + +double in_target(struct retangle f_a, struct retangle f_b); +double field(struct retangle t_a); + +int main(void){ + struct retangle rtg[2], t_rg[2]; + while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&rtg[0].p1.x,&rtg[0].p1.y,&rtg[0].p2.x,&rtg[0].p2.y,&rtg[1].p1.x,&rtg[1].p1.y,&rtg[1].p2.x,&rtg[1].p2.y) == 8){ + int max = 0, i, count = 0; + if(field(rtg[0]) < field(rtg[1])){ + max = 1; + } + t_rg[0].p1.x = rtg[max].p1.x; + t_rg[0].p2.x = rtg[max].p2.x; + t_rg[1].p1.x = rtg[!max].p1.x; + t_rg[1].p2.x = rtg[!max].p2.x; + double t_f = in_target(t_rg[0], t_rg[1]); + t_rg[0].p1.x = rtg[max].p1.y; + t_rg[0].p2.x = rtg[max].p2.y; + t_rg[1].p1.x = rtg[!max].p1.y; + t_rg[1].p2.x = rtg[!max].p2.y; + t_f *= in_target(t_rg[0], t_rg[1]); + printf("%.2lf\n",t_f); + } + return 0; +} + +double in_target(struct retangle f_a, struct retangle f_b){ + int count = 0; + double x1 = f_a.p1.x, x2 = f_a.p2.x, temp, p_x1, p_x2; + if(f_a.p1.x > f_a.p2.x){ + temp = x1; + x1 = x2; + x2 = temp; + } + if(f_b.p1.x > x1 && f_b.p1.x < x2) p_x1 = f_b.p1.x, p_x2 = f_b.p2.x, count++; + if(f_b.p2.x > x1 && f_b.p2.x < x2) p_x1 = f_b.p2.x, p_x2 = f_b.p1.x, count++; + double inl = 0.0, a_l = ABS(f_b.p1.x - x1), b_l = ABS(f_b.p2.x - x2); + if(count == 0) inl = 0.0; + else if(count == 2) inl = ABS(f_b.p1.x - f_b.p2.x); + else if(ABS(p_x2 - x1) > ABS(p_x2 - x2)){ + inl = ABS(p_x1 - x2); + } + else{ + inl = ABS(p_x1 - x1); + } + return inl; +} + +double field(struct retangle t_a){ + double r_f = ABS(t_a.p1.x - t_a.p2.x) * ABS(t_a.p1.y - t_a.p2.y); + return r_f; +} + + diff --git a/2056/problem.build b/2056/problem.build new file mode 100644 index 0000000..cf808be Binary files /dev/null and b/2056/problem.build differ diff --git a/2056/problem.build.dSYM/Contents/Info.plist b/2056/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/2056/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/2056/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/2056/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..c97ebf9 Binary files /dev/null and b/2056/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/2056/problem.set b/2056/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2056/stdin b/2056/stdin new file mode 100644 index 0000000..1e6c2a6 --- /dev/null +++ b/2056/stdin @@ -0,0 +1 @@ +0.0 9.28 -1.0 -9.674 -2.3324 10.43 5.435 4.345 diff --git a/2056/stdout b/2056/stdout new file mode 100644 index 0000000..9bbaf26 --- /dev/null +++ b/2056/stdout @@ -0,0 +1 @@ +4.93 diff --git a/2057/main.c b/2057/main.c new file mode 100644 index 0000000..a450c0d --- /dev/null +++ b/2057/main.c @@ -0,0 +1,12 @@ +#include + +int main(void){ + long long a,b; + while(scanf("%llx %llx",&a,&b) == 2){ + if (a+b >= 0) + printf("%llX\n",a+b); + else + printf("-%llX\n",-(a+b)); + } + return 0; +} diff --git a/2057/problem.build b/2057/problem.build new file mode 100644 index 0000000..b6431c4 Binary files /dev/null and b/2057/problem.build differ diff --git a/2057/problem.set b/2057/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2057/stdin b/2057/stdin new file mode 100644 index 0000000..8f5cbfc --- /dev/null +++ b/2057/stdin @@ -0,0 +1,6 @@ ++A -A ++1A 12 +1A -9 +-1A -12 +1A -AA +FFFFFFFFFFFFFFF FFFFFFFFFFFFFFF diff --git a/2057/stdout b/2057/stdout new file mode 100644 index 0000000..c36275d --- /dev/null +++ b/2057/stdout @@ -0,0 +1,6 @@ +0 +2C +11 +-2C +-90 +1FFFFFFFFFFFFFFE diff --git a/2058/main.c b/2058/main.c new file mode 100644 index 0000000..01ee3a5 --- /dev/null +++ b/2058/main.c @@ -0,0 +1,18 @@ +#include +#include +#define MIN(x,y) ((x)>(y)?(y):(x)) + +int main(void){ + unsigned long long n,m; + int count = 0; + register unsigned long long i,a1; + while(scanf("%llu %llu",&n,&m) == 2 && n+m){ + register unsigned long long num = sqrt(2*m); + for(i = num; i >= 1; i--){ + a1 = (m-((i-1)*i)/2)/i; + if(a1 > 0 && m == i*a1+(i*(i-1))/2) printf("[%llu,%llu]\n",a1,a1+i-1); + } + printf("\n"); + } + return 0; +} diff --git a/2058/problem.build b/2058/problem.build new file mode 100644 index 0000000..b3acfc2 Binary files /dev/null and b/2058/problem.build differ diff --git a/2058/problem.set b/2058/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2058/stdin b/2058/stdin new file mode 100644 index 0000000..32b12ed --- /dev/null +++ b/2058/stdin @@ -0,0 +1,3 @@ +20 10 +50 30 +0 0 diff --git a/2058/stdout b/2058/stdout new file mode 100644 index 0000000..4dde50a --- /dev/null +++ b/2058/stdout @@ -0,0 +1,8 @@ +[1,4] +[10,10] + +[4,8] +[6,9] +[9,11] +[30,30] + diff --git a/2059/main.c b/2059/main.c new file mode 100644 index 0000000..4535ab5 --- /dev/null +++ b/2059/main.c @@ -0,0 +1,6 @@ +#include + +int main(void){ + + return 0; +} diff --git a/2059/problem.set b/2059/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2059/stdin b/2059/stdin new file mode 100644 index 0000000..e69de29 diff --git a/2059/stdout b/2059/stdout new file mode 100644 index 0000000..e69de29 diff --git a/2061/main.c b/2061/main.c new file mode 100644 index 0000000..d8cb69e --- /dev/null +++ b/2061/main.c @@ -0,0 +1,29 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int count,c_count,i; + double score, credit; + double sum_s, sum_c; + char name[35]; + for(count = 0; count < numbers; count++){ + scanf("%d",&c_count); + int if_do = 1; + sum_s = 0.0, sum_c = 0.0; + for(i = 0; i < c_count; i++){ + scanf("%s %lf %lf",name, &credit, &score); + if (score < 60){ + if_do = 0; + } + else{ + sum_c += credit; + sum_s += credit * score; + } + } + if(if_do) printf("%.2lf\n",sum_s/sum_c); + else printf("Sorry!\n"); + if(count != numbers -1) printf("\n"); + } + return 0; +} diff --git a/2061/problem.build b/2061/problem.build new file mode 100644 index 0000000..48cb7a8 Binary files /dev/null and b/2061/problem.build differ diff --git a/2061/problem.set b/2061/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2061/stdin b/2061/stdin new file mode 100644 index 0000000..ab3062c --- /dev/null +++ b/2061/stdin @@ -0,0 +1,8 @@ +2 +3 +Algorithm 3 97 +DataStruct 3 90 +softwareProject 4 85 +2 +Database 4 59 +English 4 81 diff --git a/2061/stdout b/2061/stdout new file mode 100644 index 0000000..6cac716 --- /dev/null +++ b/2061/stdout @@ -0,0 +1,3 @@ +90.10 + +Sorry! diff --git a/2070/main.c b/2070/main.c new file mode 100644 index 0000000..a661bac --- /dev/null +++ b/2070/main.c @@ -0,0 +1,13 @@ +#include + +int main(void){ + int numbers,i; + unsigned long long fib[51]={0,1}; + for(i = 2; i <= 50; i++){ + fib[i] = fib[i-1] + fib[i-2]; + } + while(scanf("%d",&numbers) && numbers >= 0){ + printf("%llu\n",fib[numbers]); + } + return 0; +} diff --git a/2070/problem.build b/2070/problem.build new file mode 100644 index 0000000..82e9aeb Binary files /dev/null and b/2070/problem.build differ diff --git a/2070/problem.set b/2070/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2070/stdin b/2070/stdin new file mode 100644 index 0000000..36ff177 --- /dev/null +++ b/2070/stdin @@ -0,0 +1,4 @@ +3 +4 +5 +-1 diff --git a/2070/stdout b/2070/stdout new file mode 100644 index 0000000..e543d39 --- /dev/null +++ b/2070/stdout @@ -0,0 +1,3 @@ +2 +3 +5 diff --git a/2071/main.c b/2071/main.c new file mode 100644 index 0000000..2817592 --- /dev/null +++ b/2071/main.c @@ -0,0 +1,21 @@ +#include + +int main(void){ + int numbers,count,c_count,i; + double hgt[105]; + scanf("%d",&numbers); + for(count = 0; count < numbers; count++){ + scanf("%d",&c_count); + for(i = 0; i < c_count; i++){ + scanf("%lf",&hgt[i]); + } + + int if_ch = 1; + double max = hgt[0]; + for(i = 0; i < c_count; i++){ + if(hgt[i] > max) max = hgt[i]; + } + printf("%.2lf\n",max); + } + return 0; +} diff --git a/2071/problem.build b/2071/problem.build new file mode 100644 index 0000000..c71504e Binary files /dev/null and b/2071/problem.build differ diff --git a/2071/problem.set b/2071/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2071/stdin b/2071/stdin new file mode 100644 index 0000000..54459c5 --- /dev/null +++ b/2071/stdin @@ -0,0 +1,3 @@ +2 +3 170.00 165.00 180.00 +4 165.00 182.00 172.00 160.00 diff --git a/2071/stdout b/2071/stdout new file mode 100644 index 0000000..8fc2289 --- /dev/null +++ b/2071/stdout @@ -0,0 +1,2 @@ +180.00 +182.00 diff --git a/2075/main.c b/2075/main.c new file mode 100644 index 0000000..10625ad --- /dev/null +++ b/2075/main.c @@ -0,0 +1,14 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i; + for(i = 0; i < numbers; i++){ + unsigned long long a,b; + scanf("%llu %llu",&a,&b); + if(!(a%b)) printf("YES\n"); + else printf("NO\n"); + } + return 0; +} diff --git a/2075/problem.build b/2075/problem.build new file mode 100644 index 0000000..12d4e72 Binary files /dev/null and b/2075/problem.build differ diff --git a/2075/problem.set b/2075/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2075/stdin b/2075/stdin new file mode 100644 index 0000000..400597b --- /dev/null +++ b/2075/stdin @@ -0,0 +1,3 @@ +2 +4 2 +5 3 diff --git a/2075/stdout b/2075/stdout new file mode 100644 index 0000000..823d3f6 --- /dev/null +++ b/2075/stdout @@ -0,0 +1,2 @@ +YES +NO diff --git a/2076/main.c b/2076/main.c new file mode 100644 index 0000000..f609c49 --- /dev/null +++ b/2076/main.c @@ -0,0 +1,20 @@ +#include +#define ABS(x) ((x)>0?(x):(-(x))) + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i; + for(i = 0; i < numbers; i++){ + long hour, minute, second; + double h_a, m_a; + scanf("%ld %ld %ld",&hour, &minute, &second); + if(hour > 12) hour -= 12; + h_a = (hour * 3600 + minute * 60 + second)/43200.0; + m_a = (minute * 60 + second)/3600.0; + double angle = ABS(h_a - m_a) * 360.0; + if(angle > 180.0) angle = 360.0 - angle; + printf("%d\n",(int)angle); + } + return 0; +} diff --git a/2076/problem.build b/2076/problem.build new file mode 100644 index 0000000..cbe83eb Binary files /dev/null and b/2076/problem.build differ diff --git a/2076/problem.set b/2076/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2076/stdin b/2076/stdin new file mode 100644 index 0000000..fef72d7 --- /dev/null +++ b/2076/stdin @@ -0,0 +1,3 @@ +2 +8 3 17 +5 13 30 diff --git a/2076/stdout b/2076/stdout new file mode 100644 index 0000000..4546482 --- /dev/null +++ b/2076/stdout @@ -0,0 +1,2 @@ +138 +75 diff --git a/2078/main.c b/2078/main.c new file mode 100644 index 0000000..d8cb252 --- /dev/null +++ b/2078/main.c @@ -0,0 +1,20 @@ +#include +#define TW(x) ((x)*(x)) + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i; + for(i = 0; i < numbers; i++){ + int k,j; + int min = 100; + scanf("%d %d",&k,&j); + int c; + for(c = 0; c < k; c++){ + scanf("%d",&j); + if(min > j) min = j; + } + printf("%d\n",TW(100-min)); + } + return 0; +} diff --git a/2078/problem.build b/2078/problem.build new file mode 100644 index 0000000..7194d07 Binary files /dev/null and b/2078/problem.build differ diff --git a/2078/problem.set b/2078/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2078/stdin b/2078/stdin new file mode 100644 index 0000000..70fa153 --- /dev/null +++ b/2078/stdin @@ -0,0 +1,18 @@ +2 +2 2 +52 +25 +12 5 +89 +64 +6 +43 +56 +72 +92 +23 +20 +22 +37 +31 + diff --git a/2078/stdout b/2078/stdout new file mode 100644 index 0000000..30f1e80 --- /dev/null +++ b/2078/stdout @@ -0,0 +1,2 @@ +5625 +8836 diff --git a/2080/main.c b/2080/main.c new file mode 100644 index 0000000..d101761 --- /dev/null +++ b/2080/main.c @@ -0,0 +1,30 @@ +#include +#include +#define PI 3.1415927 +#define ZZS(x) ((x)>=0?1:-1) +#define ABS(x) ((x)>=0?(x):(-(x))) + +double agl_ch(double x,double y); + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i; + double x1,y1,x2,y2; + for(i = 0; i < numbers; i++){ + scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2); + double a1 = agl_ch(x1, y1), a2 = agl_ch(x2, y2); + double a = ABS(a1 - a2); + if(a > 180) a = 360 - a; + printf("%.2lf\n",a); + } + return 0; +} + +double agl_ch(double x,double y){ + double agl = atan(y/x) *(180/PI); + if(ZZS(x) > 0 && ZZS(y) < 0) agl = 360 + -ABS(agl); + else if(ZZS(x) < 0 && ZZS(y) > 0) agl = -ABS(agl) + 180; + else if(ZZS(x) < 0 && ZZS(y) < 0) agl = ABS(agl) + 180; + return agl; +} diff --git a/2080/problem.build b/2080/problem.build new file mode 100644 index 0000000..dcb8fca Binary files /dev/null and b/2080/problem.build differ diff --git a/2080/problem.set b/2080/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2080/stdin b/2080/stdin new file mode 100644 index 0000000..3c71957 --- /dev/null +++ b/2080/stdin @@ -0,0 +1,3 @@ +2 +1 -3 -1 1.5 +1 1 1 0 diff --git a/2080/stdout b/2080/stdout new file mode 100644 index 0000000..58b0d05 --- /dev/null +++ b/2080/stdout @@ -0,0 +1,2 @@ +164.74 +45.00 diff --git a/2081/main.c b/2081/main.c new file mode 100644 index 0000000..4a560e9 --- /dev/null +++ b/2081/main.c @@ -0,0 +1,16 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i; + char phone[12],short_num[7]={'6'}; + for(i = 0; i < numbers; i++){ + scanf("%s",phone); + int k; + for(k = 6; k < 11; k++) short_num[k-5] = phone[k]; + short_num[6] = '\0'; + printf("%s\n",short_num); + } + return 0; +} diff --git a/2081/problem.build b/2081/problem.build new file mode 100644 index 0000000..24d2b30 Binary files /dev/null and b/2081/problem.build differ diff --git a/2081/problem.set b/2081/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/2081/stdin b/2081/stdin new file mode 100644 index 0000000..4160bd6 --- /dev/null +++ b/2081/stdin @@ -0,0 +1,3 @@ +2 +13512345678 +13787654321 diff --git a/2081/stdout b/2081/stdout new file mode 100644 index 0000000..07d1557 --- /dev/null +++ b/2081/stdout @@ -0,0 +1,2 @@ +645678 +654321 diff --git a/3031/main.c b/3031/main.c new file mode 100644 index 0000000..9888d63 --- /dev/null +++ b/3031/main.c @@ -0,0 +1,26 @@ +#include +#define ABS(x) ((x>0)?(x):(-x)) + +int output[1024]; + +int main(void){ + long target, idx; + while(scanf("%ld %ld",&target,&idx) == 2){ + long i = 0, j; + int temp; + long raw = target; + target = ABS(target); + while(target > 0){ + output[i++] = target % idx; + target = (target - (target % idx)) / idx; + } + if(raw < 0) printf("-"); + for(j = 0; j < i; j++){ + temp = output[i - (j + 1)]; + if(temp < 10) printf("%d",temp); + else printf("%c",temp+55); + } + printf("\n"); + } + return 0; +} diff --git a/3031/problem.build b/3031/problem.build new file mode 100644 index 0000000..eb43df1 Binary files /dev/null and b/3031/problem.build differ diff --git a/3031/problem.set b/3031/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/3031/stdin b/3031/stdin new file mode 100644 index 0000000..e9b16bc --- /dev/null +++ b/3031/stdin @@ -0,0 +1,4 @@ +7 2 +23 12 +-4 3 +77717 16 diff --git a/3031/stdout b/3031/stdout new file mode 100644 index 0000000..2550ad4 --- /dev/null +++ b/3031/stdout @@ -0,0 +1,4 @@ +111 +1B +-11 +12F95 diff --git a/3036/main.c b/3036/main.c new file mode 100644 index 0000000..9760489 --- /dev/null +++ b/3036/main.c @@ -0,0 +1,25 @@ +#include +#define ABS(x) ((x>0)?(x):(-x)) + +struct point{ + long x; + long y; +}; + +int main(void){ + int numbers = 0; + struct point points[128]; + while(scanf("%d",&numbers) == 1 && numbers){ + int i; + double s = 0.0; + for(i = 0; i < numbers; i++){ + scanf("%ld",&points[i].x); + scanf("%ld",&points[i].y); + } + for(i = 0; i < numbers-1; i++) + s += points[i].x * points[i+1].y - points[i].y * points[i+1].x; + s += points[numbers-1].x * points[0].y - points[numbers-1].y * points[0].x; + printf("%.1lf\n",0.5*ABS(s)); + } + return 0; +} diff --git a/3036/problem.build b/3036/problem.build new file mode 100644 index 0000000..80788d3 Binary files /dev/null and b/3036/problem.build differ diff --git a/3036/problem.set b/3036/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/3036/stdin b/3036/stdin new file mode 100644 index 0000000..f414029 --- /dev/null +++ b/3036/stdin @@ -0,0 +1,3 @@ +3 0 0 1 0 0 1 +4 1 0 0 1 -1 0 0 -1 +0 diff --git a/3036/stdout b/3036/stdout new file mode 100644 index 0000000..14a13d3 --- /dev/null +++ b/3036/stdout @@ -0,0 +1,2 @@ +0.5 +2.0 diff --git a/3037/main.c b/3037/main.c new file mode 100644 index 0000000..fbc36e0 --- /dev/null +++ b/3037/main.c @@ -0,0 +1,40 @@ +#include + +struct tv_i{ + int start; + int end; +}; + +int main(void){ + int numbers; + struct tv_i tv[100]; + while(scanf("%d",&numbers) == 1 && numbers){ + int i, temp; + for(i = 0; i < numbers; i++) scanf("%d %d",&tv[i].start,&tv[i].end); + int if_change = 1; + while(if_change){ + if_change = 0; + for(i = 0; i < numbers-1; i++){ + if(tv[i].end > tv[i+1].end){ + temp = tv[i].end; + tv[i].end = tv[i+1].end; + tv[i+1].end = temp; + temp = tv[i].start; + tv[i].start = tv[i+1].start; + tv[i+1].start = temp; + if_change = 1; + } + } + } + int rtv = 0,nowt = 0; + for(i = 0; i < numbers; i++){ + if(tv[i].start >= nowt){ + rtv++; + nowt = tv[i].end; + + } + } + printf("%d\n",rtv); + } + return 0; +} diff --git a/3037/problem.build b/3037/problem.build new file mode 100644 index 0000000..278c491 Binary files /dev/null and b/3037/problem.build differ diff --git a/3037/problem.set b/3037/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/3037/stdin b/3037/stdin new file mode 100644 index 0000000..b4e3e6d --- /dev/null +++ b/3037/stdin @@ -0,0 +1,14 @@ +12 +1 3 +3 4 +0 7 +3 8 +15 19 +15 20 +10 15 +8 18 +6 12 +5 10 +4 14 +2 9 +0 diff --git a/3037/stdout b/3037/stdout new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/3037/stdout @@ -0,0 +1 @@ +5 diff --git a/3039/main.c b/3039/main.c new file mode 100644 index 0000000..afca06c --- /dev/null +++ b/3039/main.c @@ -0,0 +1,14 @@ +#include + +int main(void){ + int numbers; + scanf("%d",&numbers); + int i,count; + double a ,b ,c; + for(count = 0; count < numbers; count++){ + scanf("%lf %lf %lf",&a,&b,&c); + if(a < b + c && b < a + c && c < a + b) printf("YES\n"); + else printf("NO\n"); + } + return 0; +} diff --git a/3039/problem.build b/3039/problem.build new file mode 100644 index 0000000..8691fec Binary files /dev/null and b/3039/problem.build differ diff --git a/3039/problem.set b/3039/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/3039/stdin b/3039/stdin new file mode 100644 index 0000000..03a1868 --- /dev/null +++ b/3039/stdin @@ -0,0 +1,4 @@ +3 +1 2 3 +2 2 2 +4 1 3 diff --git a/3039/stdout b/3039/stdout new file mode 100644 index 0000000..9b18c89 --- /dev/null +++ b/3039/stdout @@ -0,0 +1,3 @@ +NO +YES +NO diff --git a/4041/main.c b/4041/main.c new file mode 100644 index 0000000..cd60690 --- /dev/null +++ b/4041/main.c @@ -0,0 +1,19 @@ +#include + +int main(void){ + int numbers,count; + scanf("%d",&numbers); + for(count = 0; count < numbers; count++){ + long astp[40] = {1,2}; + int i, stairs; + scanf("%d",&stairs); + if(stairs < 2) printf("0\n"); + else{ + for(i = 2; i < stairs; i++) + astp[i] = astp[i-1] + astp[i-2]; + printf("%ld\n",astp[stairs-2]); + } + } + return 0; +} + diff --git a/4041/problem.build b/4041/problem.build new file mode 100644 index 0000000..2710ffa Binary files /dev/null and b/4041/problem.build differ diff --git a/4041/problem.build.dSYM/Contents/Info.plist b/4041/problem.build.dSYM/Contents/Info.plist new file mode 100644 index 0000000..09786f1 --- /dev/null +++ b/4041/problem.build.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.problem.build + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/4041/problem.build.dSYM/Contents/Resources/DWARF/problem.build b/4041/problem.build.dSYM/Contents/Resources/DWARF/problem.build new file mode 100644 index 0000000..a11e389 Binary files /dev/null and b/4041/problem.build.dSYM/Contents/Resources/DWARF/problem.build differ diff --git a/4041/problem.set b/4041/problem.set new file mode 100644 index 0000000..e69de29 diff --git a/4041/stdin b/4041/stdin new file mode 100644 index 0000000..b52e52d --- /dev/null +++ b/4041/stdin @@ -0,0 +1,3 @@ +2 +1 +3 diff --git a/4041/stdout b/4041/stdout new file mode 100644 index 0000000..a9772a0 --- /dev/null +++ b/4041/stdout @@ -0,0 +1,2 @@ +0 +2