HDU oj A + B Problem II
郁闷了就相同的代码在HDUOJ上提交就是AC在NYOJ上提交就是WA字符串处理
#include<stdio.h>
#include<string.h>
#define N 1000
char x[N],y[N];
int a[N+1];
int main()
{
int g,h=0;
scanf("%d",&g);
while(g--)
{
int k1,k2,t=0,m,n,k,i,j,l;
scanf("%s %s",x,y);
k1=strlen(x);
k2=strlen(y);
for(i=k1-1,j=k2-1,l=0;i>=0&&j>=0;i--,j--,l++)
{
m=x[i]-48;
n=y[j]-48;
k=(m+n+t)%10;
a[l]=k;
t=(m+n+t)/10;
}
while(i>=0)
{
a[l++]=x[i--]-48+t;
t=0;
}
while(j>=0)
{
a[l++]=y[j--]-48+t;
t=0;
}
printf("Case %d:\n",++h);
printf("%s + %s = ",x,y);
for(i=l-1;i>=0;i--)
printf("%d",a[i]);
printf("\n");
if(g) printf("\n");
}
return 0;
}
HDU oj A + B Problem II的更多相关文章
- 抓起根本(二)(hdu 4554 叛逆的小明 hdu 1002 A + B Problem II,数字的转化(反转),大数的加法......)
数字的反转: 就是将数字倒着存下来而已.(*^__^*) 嘻嘻…… 大致思路:将数字一位一位取出来,存在一个数组里面,然后再将其变成数字,输出. 详见代码. while (a) //将每位数字取出来, ...
- HDU 1002 A + B Problem II(高精度加法(C++/Java))
A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU 1002 A + B Problem II
A + B Problem II Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16104 Accepted ...
- HDU 1002 A + B Problem II(大整数相加)
A + B Problem II Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u De ...
- HDU——1023 Train Problem II
Train Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU 1002 - A + B Problem II - [高精度]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 Problem DescriptionI have a very simple problem ...
- hdu 1002.A + B Problem II 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 题目意思:就是大整数加法. 两年几前做的,纯粹是整理下来的. #include <stdi ...
- 大数加法~HDU 1002 A + B Problem II
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1002 题意: 数学题,A+B; 思路,这个数非常大,普通加法一定会超时,所以用大数加法.大数加法的基 ...
- HDU 1002 A + B Problem II (大数加法)
题目链接 Problem Description I have a very simple problem for you. Given two integers A and B, your job ...
随机推荐
- Spring Boot (19) servlet、filter、listener
servlet.filter.listener,在spring boot中配置方式有两种:一种是以servlet3开始提供的注解方式,另一种是spring的注入方式. servlet注解方式 serv ...
- android.system.ErrnoException: open failed: ENOENT (No such file or directory) 07-19 20:27:45.011 66
在操作安卓版本23+的文件读取时,不仅要在maniests中声明,还要在代码中动态声明: ; private static String[] PERMISSIONS_STORAGE = { Manif ...
- set statistics profile on实例
set statistics profile on实例 1.SQL语句实例 SQL 代码 复制 SET STATISTICS PROFILE ON GO SELECT COUNT(b.[Sal ...
- node 连接MySQL及其分装, 连接池连接
const mysql = require('mysql') const config = require('./../../config/config.default') var connectio ...
- 人脸Pose检测:ASM、AAM、CLM总结
人脸的Pose检测可以使用基于位置约束的特征点的方法.人脸特征点定位的目的是在人脸检测的基础上,进一步确定脸部特征点(眼睛.眉毛.鼻子.嘴巴.脸部外轮廓)的位置.定位算法的基本思路是:人脸的纹理特征和 ...
- trait 和abstract的区别在哪里
无法在一个class上extend多个abstract class,但是你可以use多个trait abstract class是在类型系统上做文章,trait片段是mixin 类型约束 代码复用 c ...
- C# 聚合数据借口发短信的使用
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Hadoop 使用小命令(2)
一.查看一堆文件共有多少行 查看file1/file2目录下所有文件总共多少行 hadoop fs -text file1/file2/* | wc -l 二.正则表达式 hadoop fs -tex ...
- 【ubuntu子系统】使用windows自带的ubuntu子系统
在windows10系统中,自带了一款ubuntu子系统,就像是一个应用程序,一款软件,提供ubutnu的terminal窗口,可以使用对应的命令行模式.最重要的是,可以直接用来连接linux服务 ...
- 08.Web服务器-1.浏览器访问服务器显示页面的网络模型步骤解析