2014年3月8日
摘要: 原题链接stable_sort函数的用法。#include #include #include #include using namespace std;struct Node{ int num, sco; string name;};bool cmp(Node a, Node b){ return a.sco > b.sco;}int main(){ int t, n; Node stu; cin >> t; while(t--){ cin >> n; vector vec; while(n--){ cin >> stu.num >> s 阅读全文
posted @ 2014-03-08 23:03 长木Qiu 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 原题链接这个OJ的int不是32位的,所以坑了不少人,换成unsigned long long就行了。#include int main(){ unsigned long long t, n, a, b, d, i, j, oka; scanf("%lld", &t); while(t--){ scanf("%lld", &n); oka = b = d = 0; a = i = 1; for(j = 1; j <= 32; ++j){ if(n & i){ if(!oka) oka = 1; ++d; b = 0; }el 阅读全文
posted @ 2014-03-08 22:43 长木Qiu 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 原题链接(a-b)%c = (a%c - b%c)%c#include #include char str[105];int main(){ int c, len, a, i; while(scanf("%s", str), str[0] != '0'){ len = strlen(str); if(len == 1){ printf("0\n"); continue; } c = str[len - 1] - '0'; str[len - 1] = '\0'; if(len < 10){ sscan 阅读全文
posted @ 2014-03-08 22:04 长木Qiu 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 原题链接#include //#include int main(){ int a, b, c, count = 0; char ch, sign, s[5]; while(scanf("%d%c%d=%s", &a, &sign, &b, s) != EOF){ if(s[0] == '?') continue; if(sign == '+') c = a + b; else c = a - b; a = ch = 0; for(b = 0; s[b] != '\0'; ++b){ if(s[b] = 阅读全文
posted @ 2014-03-08 12:51 长木Qiu 阅读(137) 评论(0) 推荐(0) 编辑