POJ 2562:Primary Arithmetic
| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 11135 | Accepted: 4093 |
Description
of carry operations for each of a set of addition problems so that educators may assess their difficulty.
Input
Output
Sample Input
123 456
555 555
123 594
0 0
Sample Output
No carry operation.
3 carry operations.
1 carry operation.
Source
你 离 开 了 , 我 的 世 界 里 只 剩 下 雨 。 。 。
#include <cstdio>
int main()
{
long int a, b;
int carry, c;
while (scanf("%ld%ld", &a, &b) , a + b)
{
carry = c = 0;
while (a || b)
{
c = (a % 10 + b % 10 + c) > 9 ? 1 : 0;
carry += c;
a /= 10;
b /= 10;
}
if (carry == 0)puts("No carry operation.");
else if (carry == 1)puts("1 carry operation.");
else printf("%d carry operations.\n", carry);
}
return 0;
}
POJ 2562:Primary Arithmetic的更多相关文章
- BNUOJ 1006 Primary Arithmetic
Primary Arithmetic 来源:BNUOJ 1006http://www.bnuoj.com/v3/problem_show.php?pid=1006 当你在小学学习算数的时候,老师会教你 ...
- UVA OJ 10035 - Primary Arithmetic
Primary Arithmetic Children are taught to add multi-digit numbers from right-to-left one digit at a ...
- 1350. Primary Arithmetic
Children are taught to add multi-digit numbers from right-to-left one digit at a time. Many find th ...
- POJ 2562
#include<iostream> #include<algorithm> #define MAXN 15 using namespace std; //int rec[MA ...
- 九度OJ 1143:Primary Arithmetic(初等数学) (进位)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:616 解决:254 题目描述: Children are taught to add multi-digit numbers from ri ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
- Zerojudge解题经验交流
题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识 ...
- (Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO
http://www.cnblogs.com/sxiszero/p/3618737.html 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年 ...
- ACM训练计划step 1 [非原创]
(Step1-500题)UVaOJ+算法竞赛入门经典+挑战编程+USACO 下面给出的题目共计560道,去掉重复的也有近500题,作为ACMer Training Step1,用1年到1年半年时间完成 ...
随机推荐
- [Python3网络爬虫开发实战] 1.2.6-aiohttp的安装
之前介绍的Requests库是一个阻塞式HTTP请求库,当我们发出一个请求后,程序会一直等待服务器响应,直到得到响应后,程序才会进行下一步处理.其实,这个过程比较耗费资源.如果程序可以在这个等待过程中 ...
- delphi GDI+ [1]
摘抄自:万一的博客 安装头文件:http://www.cnblogs.com/del/archive/2008/06/06/1215319.html 目录 基本使用方法(绘制直线) 绘制一组直线 绘制 ...
- Hadoop安装与配置
Hadoop介绍 上面是官方介绍,翻一下来总结一句话就是:Hadoop是一个高可用,用于分布式处理大规模计算的工具. Hadoop1.2 下载 . Hadoop1.2 安装 1. 安装jDK 2. 配 ...
- sqlserver同一个局域网内,把服务器数据库备份到客户端
1.客户端主机创建网络共享文件夹 2.远程服务器运行: EXEC sp_configure 'show advanced options', 1;-- 允许配置高级选项--配置选项'show adva ...
- xtu summer individual 6 B - Number Busters
Number Busters Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. ...
- english & utils & tools
english & utils & tools https://openlanguage.com/ https://www.grammarly.com/blog/email-writi ...
- [K/3Cloud] 在插件中为辅助资料赋值
因为辅助资料其实是一种特殊的基础资料,其赋值方法跟基础资料类似 this.Model.SetItemValueByNumber("FAssistant1", "Ameri ...
- openjudge6252 带通配符的字符串匹配
描述 通配符是一类键盘字符,当我们不知道真正字符或者不想键入完整名字时,常常使用通配符代替一个或多个真正字符.通配符有问号(?)和星号(*)等,其中,“?”可以代替一个字符,而“*”可以代替零个或多个 ...
- apple网址
https://developer.apple.com/downloads/index.action# 开发工具下载
- Object-C 打开工程,选择模拟起时,提示"no scheme"
错误提示,如下图: 解决思路: