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 ...
随机推荐
- pycharm+QT4的helloworld
# -*- coding: utf-8 -*- from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 exc ...
- sobel流水线操作Verilog程序
sobel算子的verilog实现,采用了流水线操作 module sobel_computer ( clock , reset, OrigDataEn, //SobelAluEn, OrigData ...
- coreldraw圆形裁剪
裁剪方法: http://zhidao.baidu.com/link?url=9-OuTkkr7igOHgKDOhJgU6iUYY5MeGEGdNXX8p6RGq79Im4va0UdMAmH4gSDz ...
- The connection to adb is down, and a severe error has occured.问题解决
遇到问题描述: 运行android程序控制台输出 [2013-06-25 11:10:32 - MyWellnessTracker] The connection to adb is down, an ...
- [置顶] T-sql sql server 设置主键约束、标示列、唯一约束、默认值、约束、创建表
----选择数据库 use ythome go ----查看表是否存在 if Exists ( select * from sysobjects where name='sys_menu' and t ...
- 个人mysql配置命令
Microsoft Windows [版本 6.1.7601]版权所有 (c) 2009 Microsoft Corporation.保留所有权利. C:\Windows\system32>cd ...
- QT序列化操作(比较复杂和完善)
应用需求: 在网盘开发过程中有这样一个需求,即对文件版本进行控制,即记录文件版本的更替信息,这里说的更替信息仅仅是记录不同时刻的文件变化,即文件的增.删.改.重命名等操作.在每个待监控的目录下都会保存 ...
- Android圆形图片自定义控件
Android圆形图片控件效果图如下: 代码如下: RoundImageView.java package com.dxd.roundimageview; import android.content ...
- 基于visual Studio2013解决C语言竞赛题之0610冒泡排序函数
题目
- boost库中thread多线程详解2——mutex与lock
1. mutex对象类 mutex类主要有两种:独占式与共享式的互斥量.▲ 独占式互斥量:mutex: 独占式的互斥量,是最简单最常用的一种互斥量类型try_mutex: 它是mutex的同义词,为了 ...
