UVA 10494-If We Were a Child Again(一流的塔尔苏斯)
Problem C
If We Were a Child Again
Input: standard input
Output: standard output
Time Limit: 7 seconds
|
“Oooooooooooooooh! If I could do the easy mathematics like my school days!! I can guarantee, that I’d not make any mistake this time!!” Says a smart university student!! But his teacher even smarter – “Ok! I’d assign you such projects in your software lab. Don’t be so sad.” “Really!!” - the students feels happy. And he feels so happy that he cannot see the smile in his teacher’s face. |
![]() |
|
|
The Problem The first project for the poor student was to make a calculator that can just perform the basic arithmetic operations. But like many other university students he doesn’t like to do any project by himself. He just wants to collect programs from here and there. As you are a friend of him, he asks you to write the program. But, you are also intelligent |
||
|
Input Input is a sequence of lines. Each line will contain an input number. One or more spaces. A sign (division or mod). Again spaces. And another input number. Both the input numbers are non-negative integer. The first one may be arbitrarily |
||
OutputA line for each input, each containing an integer. See the sample input and output. Output should not contain any extra space. |
||
Sample Input110 / 100 99 % 10 2147483647 / 2147483647 2147483646 % 2147483647 |
||
Sample Output1 9 1 2147483646 |
||
第一次用java写,曾经从来没看过,今天看了一点主要的输入输出切了一道A+B后,直接来一道高精度的。1A
,没有编译器,直接敲完就交,谁给我的勇气?。。。
待会写一篇总结java里面的高精度大数的使用方法
import java.io.*; import java.util.*; import java.math.*;
import java.text.*;
public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); BigInteger a,b;char c;
while(in.hasNext()){
a = in.nextBigInteger(); c=in.next().charAt(0);
b = in.nextBigInteger(); if(c=='/')
System.out.println(a.divide(b));
else
System.out.println(a.mod(b)); } } }
版权声明:本文博客原创文章。博客,未经同意,不得转载。
UVA 10494-If We Were a Child Again(一流的塔尔苏斯)的更多相关文章
- uva 10494 - If We Were a Child Again 大数除法和取余
uva 10494 - If We Were a Child Again If We Were a Child Again Input: standard inputOutput: standard ...
- (高精度运算4.7.27)UVA 10494 If We Were a Child Again(大数除法&&大数取余)
package com.njupt.acm; import java.math.BigInteger; import java.util.Scanner; public class UVA_10494 ...
- UVA - 10494 If We Were a Child Again
用java写的大数基本操作,java要求的格式比较严谨. import java.util.*; import java.math.*; public class Main { public stat ...
- UVA 10494 (13.08.02)
点此连接到UVA10494 思路: 采取一种, 边取余边取整的方法, 让这题变的简单许多~ AC代码: #include<stdio.h> #include<string.h> ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- Volume 1. Big Number(uva)
如用到bign类参见大整数加减乘除模板 424 - Integer Inquiry #include <iostream> #include <string> #include ...
- 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第五章 2(Big Number)
这里的高精度都是要去掉前导0的, 第一题:424 - Integer Inquiry UVA:http://uva.onlinejudge.org/index.php?option=com_onlin ...
- ACM java写法入门
打2017icpc沈阳站的时候遇到了大数的运算,发现java与c++比起来真的很赖皮,竟然还有大数运算的函数,为了以后打比赛更快的写出大数的算法并且保证不错,特意在此写一篇博客, 记录java的大数运 ...
- UVA大模拟代码(白书训练计划1)UVA 401,10010,10361,537,409,10878,10815,644,10115,424,10106,465,10494
白书一:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=64609#overview 注意UVA没有PE之类的,如果PE了显示WA. UVA ...
随机推荐
- 轻量级数据库sqlite的编译
sqlite是很多客户端程序所使用的一种轻量级数据库,但是目前没有lib文件,只有源码和dll文件,我们可以利用VS工具生成lib,然后在应用程序中使用. (1)下载地址 http://www.sql ...
- struts2上传图片
在WEB-INF下新建一个content目录,建立一个upload.jsp <%@ page contentType="text/html; charset=UTF-8" l ...
- Chapter 2.策略模式
首先贴一段代码: package xiao; import java.util.Scanner; class CashSuper{ private int num; private dou ...
- AzureDev 社区活动获奖者公布
今天,我们高兴地宣布 AzureDev社区活动的获奖者,并向这 5 个非盈利技术教育组织发放 10 万美元奖金.在 2013 年的Build大会上宣布的 AzureDev 活动专注于通过代码改变世界, ...
- line-height具体解释
章:浏览器与Hack].7.3.5 应用:单行文字在垂直方向居中在网页设计中,往往为了突出标题而加入背景图案.如图7-31所看到的. watermark/2/text/aHR0cDovL2Jsb2cu ...
- ORACLE列值合併
合併列值最通用的方法就是寫一個自定義函數去實現,這裏介紹的是其它方法. 在SQL Server中合併列值能够使用For Xml Path,在Oracle中則能够使用wm_concat 或 ListAg ...
- Oracle中查询各种对象的方法小结
--查看当前库中的所有表select * from all_tables a where a.table_name='INFOCODE_P20081'--查看表结构select * from all_ ...
- MSSql跨数据库查询
select d.PostTime ,l.name from DatabaseLog d ,lumigent.dbo.test l 一定要加.dbo,不加dbo不行啊 select * from lu ...
- BZOJ 4145: [AMPPZ2014]The Prices( 状压dp + 01背包 )
我自己只能想出O( n*3^m )的做法....肯定会T O( nm*2^m )做法: dp( x, s ) 表示考虑了前 x 个商店, 已买的东西的集合为s. 考虑转移 : 先假设我们到第x个商店去 ...
- 利用xshell密钥管理服务器远程登录+VIM dd命令操作之伤之再伤
1.打开Xshell界面,中文界面方便操作,菜单栏:工具——新建用户密钥生成向导 2.密钥类型选择RSA,密钥长度选择2048位,单击下一步继续: 3.很快生成公钥对,单击下一步继续: 4.密钥名称可 ...
