国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

1001. A+B Format

2019-11-08 03:08:04
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).

Input

Each input file contains one test case. Each case contains a pair of integers a and b where -1000000 <= a, b <= 1000000. The numbers are separated by a space.

Output

For each test case, you should output the sum of a and b in one line. The sum must be written in the standard format.

Sample Input
-1000000 9Sample Output

-999,991

#include <cstdio>#include <cstdlib>#include<iostream>using namespace std;#include <deque>#include <queue>#include <string>using namespace std;int main(){    int a,b,x;    string s;    cin>>a;    cin>>b;    a=a+b;    int count=0;    if(a==0)    cout<<0<<endl;  if(a<0)    cout<<'-';  while(a)  {    x=a%10;    a=a/10;    if(x<0)      x=-x;    s=char(x%10+'0')+s;    count++;    if(count==3&&a)    {      s=','+s;      count=0;    }  }  cout<<s;  return 0;}


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 滨海县| 镇原县| 尚志市| 张掖市| 华阴市| 孝感市| 绥阳县| 武平县| 江陵县| 忻州市| 雅安市| 金乡县| 沁源县| 江川县| 鲁山县| 南通市| 红原县| 平果县| 金川县| 鄱阳县| 图们市| 彭水| 连山| 宣威市| 榆社县| 敦煌市| 当涂县| 新源县| 罗田县| 昌都县| 望城县| 大竹县| 宝鸡市| 天峻县| 沛县| 江源县| 建水县| 广水市| 吐鲁番市| 岳阳县| 奉节县|