上一页 1 2 3 4 5 6 7 8 9 ··· 17 下一页
  2014年3月7日
摘要: 原题链接#include int main(){ int n, count; while(scanf("%d", &n), n){ count = 0; while(n > 2){ count += n / 3; n = n / 3 + n % 3; } if(n == 2) ++count; printf("%d\n", count); } return 0;} 阅读全文
posted @ 2014-03-07 20:14 长木Qiu 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 原题链接注意1, 1, 3的情况。#include int main(){ int i = 1, a, b, c, count, t; scanf("%d", &t); while(t--){ scanf("%d%d%d", &a, &b, &c); count = 0; if(a + b > c && a - b < c && b - a < c) ++count; if(a == b || a == c || b == c) if(count) ++count; if( 阅读全文
posted @ 2014-03-07 19:38 长木Qiu 阅读(144) 评论(0) 推荐(0) 编辑
  2014年3月5日
摘要: 原题链接#include #include using namespace std;int main(){ string str; int n; while(cin >> str >> n){ int len = str.size(); n %= len; int count = len - n, j = 0; while(j < len){ cout << str.at(count++ % len); ++j; } cout << endl; } return 0;} 阅读全文
posted @ 2014-03-05 17:02 长木Qiu 阅读(143) 评论(0) 推荐(0) 编辑
  2014年3月3日
摘要: 原题链接#include #include using namespace std;char str[10];int main(){ int t, n; cin >> t; while(t--){ cin >> n; for(int i = 1; i <= n; ++i) str[i - 1] = i + '0'; str[n] = '\0'; do{ cout << str << endl; }while(next_permutation(str, str + n)); } return 0;} 阅读全文
posted @ 2014-03-03 17:48 长木Qiu 阅读(161) 评论(0) 推荐(0) 编辑
  2014年3月2日
摘要: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1、2、3、4、5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDIATE DECODABILITY Huffman编码1013 STAMPS 搜索or动态规划1014 Border 模拟题1015 Simple Ar 阅读全文
posted @ 2014-03-02 16:34 长木Qiu 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 原题链接判断等比的时候注意防止除数为0和不能整除的情况。#include int a[11];int main(){ int i, flag, t; while(scanf("%d", &a[1]) == 1){ for(i = 2; i != 6; ++i) scanf("%d", &a[i]); flag = 0; if(!flag){ t = a[2] - a[1]; for(i = 3; i != 6; ++i) if(a[i] - a[i - 1] != t) break; if(i == 6) flag = 1; //等差 } 阅读全文
posted @ 2014-03-02 09:55 长木Qiu 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 原题链接#include int main(){ int a[5], t, s, st, i; while(scanf("%d", &a[0]) == 1){ st = a[0] * 10 + 5; s = 0; for(i = 1; i != 5; ++i){ scanf("%d", &a[i]); st += a[i] * 10 + 5; } for(i = 0; i != 5; ++i){ scanf("%d", &t); s += t;; } if(s <= st) puts("No ! 阅读全文
posted @ 2014-03-02 09:08 长木Qiu 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 原题链接在win7下测试老是不对,后来注意到,win下汉字占2字节,ubuntu是3字节。#include #include char str[300], sam[] = "你我";int main(){ int len, i; while(scanf("%s", str)){ len = strlen(str); if(len == 1 && str[0] == '0') break; for(i = 0; i != len; ++i) if(str[i] == sam[0] && str[i+ 1] = 阅读全文
posted @ 2014-03-02 08:49 长木Qiu 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 原题链接经典题。必然事件。证明:令s1=a1 %n, s2=(a1+a2) %n, ... ,sn=(a1+a2+a3+...+an) % n;若s1---sn中有值为0,则直接YES;否则以上n个s中必定有两个值相等,因为结果在1---n-1之间,共n-1种情况,则两数相减即为n的倍数。#include int main(){ int n, t; while(scanf("%d", &n) == 1){ while(n--) scanf("%d", &t); printf("YES\n"); } return 0;} 阅读全文
posted @ 2014-03-02 00:33 长木Qiu 阅读(121) 评论(0) 推荐(0) 编辑
  2014年3月1日
摘要: 原题链接十进制转换成二进制时要注意不足补0,二进制转十进制不需要考虑这种情况。#include #include char str[35], buf[35];void f1(){ int t, i; char *p = strtok(str, "."); buf[8] = '\0'; while(p != '\0'){ sscanf(p, "%d", &t); i = 8; while(t){ buf[--i] = t % 2 + '0'; t /= 2; } while(i) buf[--i] = 阅读全文
posted @ 2014-03-01 23:51 长木Qiu 阅读(103) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 17 下一页