摘要:
#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... 阅读全文
摘要:
陷阱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.这句话是 阅读全文
摘要:
#includeint main(){int i, j;while(scanf("%d%d", &i, &j) == 2)printf("%d\n", i + j);return 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 阅读全文