摘要: 我起先写的是在循环中对100取余,然后对10取余输出答案,可是提交后超时。下面是转载的。 #include int calc(int a, int b){ if(a==0 || a==1 || a==5 || a==6) return a; if(a==2) { ... 阅读全文
posted @ 2015-03-04 19:52 StevenLuke 阅读(203) 评论(0) 推荐(0) 编辑
摘要: min = s1int main() { int n, i, j, a, b, c, d, s1, s2, min; while(scanf("%d", &n) != EOF) { for(i=0; i<n; i++) { scanf("%d%d%d%d", &a, &b, &c, &d... 阅读全文
posted @ 2015-03-02 17:55 StevenLuke 阅读(159) 评论(0) 推荐(0) 编辑
摘要: #include int main() { int n, i, m, a[45]; while(scanf("%d", &n) != EOF) { a[1] = 0; a[2] = 1; a[3] = 2; for(i=4; i<=40; i++) a[i] = a[i-1] +... 阅读全文
posted @ 2015-03-02 17:04 StevenLuke 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include #include int main() { int n, i, j, l, num1, num2, num3, num4, num5; char s[101]; while(scanf("%d", &n) != EOF) { for(i=0; i<n; i++) { n... 阅读全文
posted @ 2015-03-02 16:44 StevenLuke 阅读(138) 评论(0) 推荐(0) 编辑
摘要: ans = ((m + k) / 2 * n) % 10000;写成这样AC, ans = (n / 2 * (m+k)) % 10000;写成这样WA。 未解 #include int main() { int n, m, k, ans, t, i; while(scanf("%d", &... 阅读全文
posted @ 2015-03-02 15:18 StevenLuke 阅读(119) 评论(0) 推荐(0) 编辑
摘要: #include int main() { int n, i, j, a, b, sum1, sum2; while(scanf("%d", &n) != EOF) { for(i=0; i<n; i++) { scanf("%d%d", &a, &b); sum1 = 0; ... 阅读全文
posted @ 2015-03-01 17:00 StevenLuke 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include int main() { int n, i, flag; while(scanf("%d", &n) != EOF) { flag = 1; // 1 表示 off, -1 表示 on for(i=1; i<=n; i++) { if(n%i==0) flag... 阅读全文
posted @ 2015-03-01 16:31 StevenLuke 阅读(144) 评论(0) 推荐(0) 编辑
摘要: J 如果不这样写会超市#include #include int main() { int n, m, i, j; while(scanf("%d%d", &n, &m) != EOF) { if(n==0 && m==0) break; for(j=(int)sqrt((do... 阅读全文
posted @ 2015-03-01 16:19 StevenLuke 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 暴力解法,同百钱买白鸡 #include int main() { int n, i, j, k, l, m, ans; while(scanf("%d", &n) != EOF) { if(n==0) { printf("1\n"); continue; } ans = 0; ... 阅读全文
posted @ 2015-03-01 15:54 StevenLuke 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 贪心算法,同类于看电视的还有老鼠拿钱和猫换食物。 #include #include using namespace std;struct time { int s; int e; bool operator < (const time &A) const { return e < A.e;... 阅读全文
posted @ 2015-02-27 15:52 StevenLuke 阅读(125) 评论(0) 推荐(0) 编辑