PKU 2291. Rotten Ropes. AC get -_-!
#include #include int cal[1000]; int chk(const void * a,const void * b) { if (*(int*)a > *(int*)b) { return -1; } else if (*(int*)a == *(int*)b) { return 0; } else { return 1; } } int main() { int cases, n, t, w, i, j, max; scanf("%d", &cases); while(cases--) { max = 0; scanf("%d", &n); for (i = 0; i max) { max = cal[i]; } } qsort(cal, n, sizeof(int..
더보기
PKU 3032. Card Trick. AC get -_-
#include #include using namespace std; void repack(int * target, int * src, int start,int size) { memcpy(target, src + start - size, size); memcpy(src, src + start - size, start - size); memcpy(src, target, size); } int main() { int arr[13], cnt, cases, input, i, movset, temparr[13]; cin >> cases; while (cases--) { for (cnt = 0; cnt > input; cnt = 1; while (in..
더보기
PKU 1422. Air raid. WA -_-....
#include int found[10001][10001]; int result[10001][10001]; int main() { int cases, inters, streets, start, end, i, j, k, l, sum; scanf("%d", &cases); while (cases--) { scanf("%d", &inters); scanf("%d", &streets); while (streets--) { scanf("%d%d", &start, &end); found[start][end] = 1; result[start][end] = 1; } for (i = 1; i < inters; i++) { for (j = 1; j
더보기
PKU 2844. Sum and Product. TLE -_-
#include __int64 multipoint[100000]; __int64 factors[100000]; int main() { __int64 n, s, p, factnum, i, j, sum, prod, count; while(~scanf("%d%d%d", &n, &s, &p)) { /* initialize & input */ factnum = 0; for (i = 1; i < s; i++) { if (p % i == 0) { factors[factnum] = i; factnum++; } } for (i = 0; i < n; i++) { multipoint[i] = factnum - 1; } /* calculating */ while (multipoint[n - 1] != 0) { for (i =..
더보기