摘要: #include #include using namespace std;int main(){ int T, count_T; char a[1001], b[1001], ans[1002]; cin >> T; for(count_T=1; count_T > a >> b; int la=strlen(a)-1, lb=strlen(b)-1, sign=0, i; for(i=0;la>=0 && lb>=0; la--,lb--,i++) { sign += a[la] + b[lb] - '0... 阅读全文
posted @ 2014-03-16 21:22 FREE小宝 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 陷阱1:输出两个空行陷阱2:使用求和公式看两段代码:第一段:利用循环intn,sum;while(scanf("%d",&n)!=EOF){sum=0;while(n)sum+=n--;printf("%d\n\n",sum);}第二段:利用求和公式intn,sum;while(scanf("%d",&n)!=EOF){printf("%d\n\n",n*(n+1)/2);}Youmayassumetheresultwillbeintherangeof32-bitsignedinteger.这句话是 阅读全文
posted @ 2014-03-16 20:08 FREE小宝 阅读(256) 评论(0) 推荐(0) 编辑
摘要: #includeint main(){int i, j;while(scanf("%d%d", &i, &j) == 2)printf("%d\n", i + j);return 0;}关键循环读取 阅读全文
posted @ 2014-03-16 20:05 FREE小宝 阅读(98) 评论(0) 推荐(0) 编辑
摘要: LanguageCC++PascalTo read numbersint n;while(scanf("%d", &n) != EOF){ ...}int n;while (cin >> n){ ...}var n: integer;...while not seekeof dobegin read(n); ...end;To read charactersint c;while ((c = getchar()) != EOF){ ...}char c;while (cin.get(c)){ ...}var c: char;...while not eo 阅读全文
posted @ 2014-03-16 20:04 FREE小宝 阅读(159) 评论(0) 推荐(0) 编辑