浙大PAT (Advanced Level) Practise 1001 A+B Format (20)
2013-06-14 13:49
465 查看
/*本题是普通A+B,只是结果输出是特殊的格式*/ #include <iostream> using namespace std; int main() { int a,b,c; while(cin>>a>>b) { c=a+b; if(c<0) { c=-c; printf("-"); } if(c>=1000000) //这里对不同范围内的和的输出分类,以类似的方法解决输出问题 printf("%d,%03d,%03d\n",c/1000000,(c/1000)%1000,c%1000); else if(c>=1000) printf("%d,%03d\n",c/1000,c%1000); else printf("%d\n",c); } return 0; }
相关文章推荐
- PAT (Advanced Level) Practise 1001 A+B Format (20)
- PAT (Advanced Level) Practise 1001. A+B Format (20)
- PAT (Advanced Level) Practise 1001 A+B Format (20)
- PAT (Advanced Level) Practise 1001. A+B Format (20)
- PAT (Advanced Level) Practise - 1001 A+B Format (20)
- PAT (Advanced Level) Practise 1001 A+B Format (20)
- PAT-PAT (Advanced Level) Practise 1001. A+B Format (20) 【二星级】
- PAT (Advanced Level) Practise 1001. A+B Format (20)
- PAT (Advanced Level) Practise 1001. A+B Format (20)
- PAT-PAT (Advanced Level) Practise 1001. A+B Format (20) 【二星级】
- PAT (Advanced Level) Practise 1001. A+B Format (20)
- PAT (Advanced Level) Practise 1001. A+B Format (20)
- PAT (Advanced Level) Practise 1001 A+B Format
- PAT (Advanced Level) Practise —1001:A+B format
- 编程题目:PAT(Advanced Level) Practice 1001. A+B Format (20)
- 浙大 PAT Advanced level 1001. A+B Format
- PAT(Advanced Level)1001. A+B Format (20)
- 【PAT Advanced Level】1001. A+B Format (20)
- PAT (Advanced Level) Practise:1001. A+B Format
- 【PAT】【Advanced Level】1001. A+B Format (20)