国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 安宁市| 启东市| 二手房| 博罗县| 广汉市| 博白县| 甘谷县| 黔江区| 布尔津县| 陕西省| 娄烦县| 龙游县| 鹤壁市| 水富县| 稻城县| 合江县| 海门市| 蒙自县| 富裕县| 乾安县| 洛浦县| 方城县| 昆山市| 六枝特区| 准格尔旗| 扎囊县| 乃东县| 麻江县| 岑巩县| 留坝县| 治多县| 顺平县| 宁国市| 岳阳县| 安乡县| 海淀区| 孟津县| 卢龙县| 江门市| 临沂市| 攀枝花市|