SDUT中大数实现的题目,持续更新(JAVA实现)
SDUT2525:A-B (模板题)
import java.util.Scanner;
import java.math.*; public class Main
{ public static void main(String[] args)
{
Scanner ci = new Scanner(System.in);
BigInteger a;
BigInteger b;
while(ci.hasNext())
{
a=ci.nextBigInteger();
b=ci.nextBigInteger();
System.out.println(a.subtract(b));
}
ci.close();
} }
SDUT3134:大数取模
import java.util.Scanner;
import java.math.*; public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
BigInteger a,b;
a=cin.nextBigInteger();
b=cin.nextBigInteger();
System.out.println(a.mod(b)); }
cin.close();
} }
SDUT2613:大数加法
import java.util.Scanner;
import java.math.*; public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
BigInteger a,b;
a=cin.nextBigInteger();
b=cin.nextBigInteger();
System.out.println(a.add(b)); }
cin.close();
} }
SDUT2763: 好玩的五次方
这个题还是比较好的,利用了math中的pow方法,属于大数乘法
import java.util.Arrays;
import java.util.Scanner;
import java.math.*; public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n,t,cnt,ff;
while(cin.hasNext())
{
n=cin.nextInt();
cnt=0;
ff=-1;
int[] a=new int[n];
int[] b=new int[n];
for(int i=0;i<n;i++)
{
a[i]=cin.nextInt();
}
Arrays.sort(a);
for(int i=0;i<n;i++)
{
if(a[i]>0)
b[cnt++]=a[i];
}
for(int i=0;i<cnt;i++)
{
if(b[i]!=(i+1))
{
ff=i+1;
break;
}
}
if(ff==-1) ff=cnt+1;
BigInteger sum=BigInteger.valueOf(ff);
System.out.println(sum.pow(5)); }
cin.close();
} }
SDUT中大数实现的题目,持续更新(JAVA实现)的更多相关文章
- PHP 日常开发过程中的bug集合(持续更新中。。。)
PHP 日常开发过程中的bug集合(持续更新中...) 在日常php开发过程中,会遇到一些意想不到的bug,所以想着把这些bug记录下来,以免再犯! 1.字符串 '0.00'.'0.0'.'0' 是 ...
- UVA+POJ中大数实现的题目,持续更新(JAVA实现)
UVA10494:If We Were a Child Again 大数除法加取余 import java.util.Arrays; import java.util.Scanner; import ...
- HDU中大数实现的题目,持续更新(JAVA实现)
HDU1002:大数加法,PE了N次 import java.util.Scanner; import java.math.*; public class Main { public static v ...
- Android中常用开发工具类—持续更新...
一.自定义ActionBar public class ActionBarTool { public static void setActionBarLayout(Activity act,Conte ...
- Android开发中常用的库总结(持续更新)
这篇文章用来收集Android开发中常用的库,都是实际使用过的.持续更新... 1.消息提示的小红点 微信,微博消息提示的小红点. 开源库地址:https://github.com/stefanjau ...
- 使用jenkins中遇到的问题汇总/持续更新
jenkins产生大量日志文件 question: [DNSQuestion@1446063419 type: TYPE_IGNORE index 0, class: CLASS_UNKNOWN in ...
- Vue开发中的常用技巧(持续更新)
1. 监听子组件的生命周期例如有父组件Parent和子组件Child,如果父组件监听到子组件挂载mounted就做一些逻辑处理,常规写法可能如下: // Parent.vue <Child @m ...
- Excel中遇到的一些问题——持续更新
Q1:excel2007表格里的数字在表格关闭后再打开经常会变成日期格式,怎么解决? A1: 1)打开Excel,选中任意单元格,单击鼠标右键,选择设置单元格格式2)在数字自定义类型中,找到类似[$- ...
- vue中的一些用法,持续更新中......
1.跳转用法 @1.在template模板中通常使用router-link to='url' @2.在js中 1.this.$router.push({path: ''/order/index''}) ...
随机推荐
- 本机添加多个git仓库账号
我们可能会需要在一台电脑上以不同的github账户去使用git,这时就需要去解决如何管理本机上的多个ssh key的问题了. 生成新ssh key 如果我们电脑上已经存在了一个ssh key,那么我们 ...
- 使用GitHub建立个人网站
使用GitHub建立个人网站 1 Git简介 2 为什么使用Github Pages 3 创建Github Pages 3.1 安装git工具. 3.2 两种pages模式 3.3 创建步骤 3.4 ...
- C语言错误: CRT detected that the application wrote to memory after end of heap buffer
CRT detected that the application wrote to memory after end of heap buffer 多是中间对其进行了一些操作,在程序结束处,释放内存 ...
- git error Another git process seems to be running in this repository
How to fix error Another git process seems to be running in this repository When you use Git, you se ...
- linux 下简单的ftp客户端程序
该ftp的客服端是在linux下面写,涉及的东西也比较简单,如前ftp的简单介绍,知道ftp主要的工作流程架构,套接字的创建,还有就是字符串和字符的处理.使用的函数都是比较简单平常易见的,写的时候感觉 ...
- php -- 对象遍历
对象遍历:foreach,遍历对象的公有属性(将公有属性的值和属性名赋值给对应$value和$key) 遍历某一个属性的数组,实现Iterator接口 接口iterator:类实现Iterator接口 ...
- maven环境的配置
http://maven.oschina.net/help.html --配置说明 http://maven.oschina.net/index.html#nexus-search;quick ...
- a &a &a[0]之间的区别和联系
数组中,a为数组的首地址,&a[0]为数组第一个元素的地址. 所以 a == &a[0] 但是,&a又是什么东西呢? 我们来做下面的代码测试: #include <std ...
- 编程之美 set 10 队列中取最大值操作问题
题目 假设有这样一个拥有三个操作的队列 1. Enqueue(v) 2. Dequeue() 3. MaxEle() 请设计一种数据结构和算法, 让 MAXELE 操作的时间复杂度尽可能的低 思路 1 ...
- [置顶]JB开发之制作系统级Application
1.编译工程,生成xx.app 2.制作引导进程xx替换xx.app里面的xx进程 引导进程代码: int main(int argc, char *argv[]) { @autoreleasepoo ...