首页 > 其他分享 >1001. A+B Format (20)

1001. A+B Format (20)

时间:2022-11-25 14:34:52浏览次数:53  
标签:20 正确 Format System 答案 80 1001 out


1001. A+B Format (20)


时间限制


400 ms



内存限制



65536 kB



代码长度限制



16000 B



判题程序



Standard



作者



CHEN, Yue


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 9


Sample Output


-999,991



求两数相加后,用三位一个逗号的写出来



时间

结果

得分

题目

语言

用时(ms)

内存(kB)

用户

7月17日

20:56

答案正确

​20​

​1001​

​C++ (g++ 4.7.2)​

1

308

​datrilla​

测试点

测试点

结果

用时(ms)

内存(kB)

得分/满分

0

答案正确

1

180

9/9

1

答案正确

1

180

1/1

10

答案正确

1

308

1/1

11

答案正确

1

180

1/1

2

答案正确

1

308

1/1

3

答案正确

1

180

1/1

4

答案正确

1

308

1/1

5

答案正确

1

256

1/1

6

答案正确

1

256

1/1

7

答案正确

1

180

1/1

8

答案正确

1

308

1/1

9

答案正确

1

308

1/1

#include 


#include


using namespace std;
void pprint(int x)
{
cout<<",";
cout<

>a>>b;
a+=b;
if(abs(a)<1000)
cout<












第一次写个java,没有系统学,就用写c的思路下去,测出来的差距感受感受


评测结果


时间
结果
得分
题目
语言
用时(ms)
内存(kB)
用户


9月22日 09:08

答案正确

20

1001

Java (javac 1.6.0)

81

10668

datrilla



测试点


测试点
结果
用时(ms)
内存(kB)
得分/满分



0

答案正确

81

10520

9/9



1

答案正确

80

10480

1/1



10

答案正确

81

10372

1/1



11

答案正确

80

10380

1/1



2

答案正确

79

10416

1/1



3

答案正确

80

10304

1/1



4

答案正确

80

10480

1/1



5

答案正确

80

10400

1/1



6

答案正确

80

10416

1/1



7

答案正确

80

10508

1/1



8

答案正确

80

10376

1/1



9

答案正确

80

10668

1/1




import java.util.*;
public class Main {
public static void pprint(int x)
{
System.out.print(","+x/100);
x%=100;
System.out.print(x/10+""+x%10);
}
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int a=in.nextInt();
int b=in.nextInt();
in.close();
a+=b;
if(Math.abs(a)<1000)
System.out.print(a);
else if(Math.abs(a)<1000000)
{
System.out.print(a/1000);
pprint(Math.abs(a)%1000);
}else
{
System.out.print(a/1000000);
a=Math.abs(a)%1000000;
pprint(a/1000);
pprint(a%1000);
}
System.out.println();
}

}


标签:20,正确,Format,System,答案,80,1001,out
From: https://blog.51cto.com/datrilla/5886670

相关文章

  • 1058. A+B in Hogwarts (20)
    1058.A+BinHogwarts(20)时间限制50ms内存限制65536kB代码长度限制16000B判题程序Sta......
  • 【iOS开发必收藏】详解iOS应用程序内使用IAP/StoreKit付费、沙盒(SandBox)测试、创建测
     Himi 原创,欢迎转载,转载请在明显处注明!谢谢。//——2012-12-11日更新 获取"产品付费数量等于0这个问题"的原因看到很多童鞋问到,为什么每次都返回数量等于0??其实有童......
  • 巨杉数据库入选2022爱分析·数据智能厂商全景报告
    巨杉数据库以极具优势的技术创新与丰富的金融银行业落地经验成功入选《2022爱分析·数据智能厂商全景报告》。 近日,国内知名数字化市场研究咨询机构爱分析正式发布《2......
  • 2022-11-25Acwing每日一题
    本系列所有题目均为Acwing课的内容,发表博客既是为了学习总结,加深自己的印象,同时也是为了以后回过头来看时,不会感叹虚度光阴罢了,因此如果出现错误,欢迎大家能够指出错误,我......
  • Go 语言系列20:defer 延迟调用
    含有​​defer​​​语句的函数,会在该函数将要返回之前,调用另一个函数。简单点说就是​​defer​​语句后面跟着的函数会延迟到当前函数执行完后再执行。下面是一个简单......
  • LeetCode 20.有效的括号(简单)
    题目描述:给定一个只包括​​'('​​​,​​')'​​​,​​'{'​​​,​​'}'​​​,​​'['​​​,​​']'​​​ 的字符串​​s​​,判断字符串是否有效。有效字符串需满足:......
  • P7962 [NOIP2021] 方差
    [NOIP2021]方差时隔一年。我又回来做这个题了。。。我们通过观察是可以发现这里的操作实际上就是交换相邻差分,但是差分\(c_1\)不可被交换。然后如果要求方差最小的话......
  • Java 通过IDEA连接sqlserver2012数据库
    1、官网下载sqlserver的jdbc在这里下载:http://www.microsoft.com/zh-cn/download/details.aspx?id=117744.0版本支持的 SQLServer有:Microsoft®SQLServer®2012Mi......
  • GEE|Google Earth Engine报错Error in map(ID=LC08_123038_20190121) Element.copyPro
    本文以LANDSAT/LC08/C01/T1_SR数据集为例介绍Thesourceparameterisrequire应该如何解决。问题描述GEE平台提供了影像在线处理,在完成对数据集处理后,想要对数据进行......
  • iTOP3A5000_7A2000开发板龙芯全国产处理器LoongArch架构核心主板
    主要参数    处理器:龙芯3A5000主频:2.3GHz-2.5GHz桥片:7A2000内存:8GB、16GBDDR4带ECC纠错(配置可选)系统:Loongnix典型功耗:35W核心板:16层底板:4层核心板......