SDUT2525:A-B (模板题)

  1. import java.util.Scanner;
  2. import java.math.*;
  3.  
  4. public class Main
  5. {
  6.  
  7. public static void main(String[] args)
  8. {
  9. Scanner ci = new Scanner(System.in);
  10. BigInteger a;
  11. BigInteger b;
  12. while(ci.hasNext())
  13. {
  14. a=ci.nextBigInteger();
  15. b=ci.nextBigInteger();
  16. System.out.println(a.subtract(b));
  17. }
  18. ci.close();
  19. }
  20.  
  21. }

SDUT3134:大数取模

  1. import java.util.Scanner;
  2. import java.math.*;
  3.  
  4. public class Main
  5. {
  6. public static void main(String[] args)
  7. {
  8. Scanner cin = new Scanner(System.in);
  9. while(cin.hasNext())
  10. {
  11. BigInteger a,b;
  12. a=cin.nextBigInteger();
  13. b=cin.nextBigInteger();
  14. System.out.println(a.mod(b));
  15.  
  16. }
  17. cin.close();
  18. }
  19.  
  20. }

SDUT2613:大数加法

  1. import java.util.Scanner;
  2. import java.math.*;
  3.  
  4. public class Main
  5. {
  6. public static void main(String[] args)
  7. {
  8. Scanner cin = new Scanner(System.in);
  9. while(cin.hasNext())
  10. {
  11. BigInteger a,b;
  12. a=cin.nextBigInteger();
  13. b=cin.nextBigInteger();
  14. System.out.println(a.add(b));
  15.  
  16. }
  17. cin.close();
  18. }
  19.  
  20. }

SDUT2763: 好玩的五次方

这个题还是比较好的,利用了math中的pow方法,属于大数乘法

  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3. import java.math.*;
  4.  
  5. public class Main
  6. {
  7. public static void main(String[] args)
  8. {
  9. Scanner cin = new Scanner(System.in);
  10. int n,t,cnt,ff;
  11. while(cin.hasNext())
  12. {
  13. n=cin.nextInt();
  14. cnt=0;
  15. ff=-1;
  16. int[] a=new int[n];
  17. int[] b=new int[n];
  18. for(int i=0;i<n;i++)
  19. {
  20. a[i]=cin.nextInt();
  21. }
  22. Arrays.sort(a);
  23. for(int i=0;i<n;i++)
  24. {
  25. if(a[i]>0)
  26. b[cnt++]=a[i];
  27. }
  28. for(int i=0;i<cnt;i++)
  29. {
  30. if(b[i]!=(i+1))
  31. {
  32. ff=i+1;
  33. break;
  34. }
  35. }
  36. if(ff==-1) ff=cnt+1;
  37. BigInteger sum=BigInteger.valueOf(ff);
  38. System.out.println(sum.pow(5));
  39.  
  40. }
  41. cin.close();
  42. }
  43.  
  44. }

SDUT中大数实现的题目,持续更新(JAVA实现)的更多相关文章

  1. PHP 日常开发过程中的bug集合(持续更新中。。。)

    PHP 日常开发过程中的bug集合(持续更新中...) 在日常php开发过程中,会遇到一些意想不到的bug,所以想着把这些bug记录下来,以免再犯! 1.字符串 '0.00'.'0.0'.'0'  是 ...

  2. UVA+POJ中大数实现的题目,持续更新(JAVA实现)

    UVA10494:If We Were a Child Again 大数除法加取余 import java.util.Arrays; import java.util.Scanner; import ...

  3. HDU中大数实现的题目,持续更新(JAVA实现)

    HDU1002:大数加法,PE了N次 import java.util.Scanner; import java.math.*; public class Main { public static v ...

  4. Android中常用开发工具类—持续更新...

    一.自定义ActionBar public class ActionBarTool { public static void setActionBarLayout(Activity act,Conte ...

  5. Android开发中常用的库总结(持续更新)

    这篇文章用来收集Android开发中常用的库,都是实际使用过的.持续更新... 1.消息提示的小红点 微信,微博消息提示的小红点. 开源库地址:https://github.com/stefanjau ...

  6. 使用jenkins中遇到的问题汇总/持续更新

    jenkins产生大量日志文件 question: [DNSQuestion@1446063419 type: TYPE_IGNORE index 0, class: CLASS_UNKNOWN in ...

  7. Vue开发中的常用技巧(持续更新)

    1. 监听子组件的生命周期例如有父组件Parent和子组件Child,如果父组件监听到子组件挂载mounted就做一些逻辑处理,常规写法可能如下: // Parent.vue <Child @m ...

  8. Excel中遇到的一些问题——持续更新

    Q1:excel2007表格里的数字在表格关闭后再打开经常会变成日期格式,怎么解决? A1: 1)打开Excel,选中任意单元格,单击鼠标右键,选择设置单元格格式2)在数字自定义类型中,找到类似[$- ...

  9. vue中的一些用法,持续更新中......

    1.跳转用法 @1.在template模板中通常使用router-link to='url' @2.在js中 1.this.$router.push({path: ''/order/index''}) ...

随机推荐

  1. URLDecoder: Incomplete trailing escape (%) pattern问题处理

    http://blog.csdn.net/yangbobo1992/article/details/10076335 _________________________________________ ...

  2. 测试网站访问速度的方法(GTmetrix)

     全方位的免费网站速度测试工具 — GTmetrix 它结合了Google Page Speed和Yahoo! YSlow的网页速度测试功能,并且提供可行的建议帮你改善网站速度.会根据网站的具体情况, ...

  3. Python之打印变量

    def myprint(v): print v print type(v) try: print v.shape except: try: print len(v) except: pass

  4. CSS:scrollbar的属性及样式分类

    overflow            内容溢出时的设置(设定被设定对象是否显示滚动条) overflow-x         水平方向内容溢出时的设置 overflow-y         垂直方向 ...

  5. php -- 魔术方法 之 自动加载:__autoload()

    自动加载类 背景: 很多开发者写面向对象的应用程序时对每个类的定义建立一个 PHP 源文件.一个很大的烦恼是不得不在每个脚本开头写一个长长的包含文件列表(每个类一个文件). 在 PHP 5 中,不再需 ...

  6. 【BZOJ】1079: [SCOI2008]着色方案(dp+特殊的技巧)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1079 只能想到5^15的做法...........................果然我太弱. 其实 ...

  7. 【BZOJ】1682: [Usaco2005 Mar]Out of Hay 干草危机(kruskal)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1682 最小生成树裸题.. #include <cstdio> #include < ...

  8. SharePoint Survey WebPart 调查 Web部件

    SharePoint Survey WebPart 调查 Web部件 Web部件下载地址 点击此处下载. 安装激活Web部件 过程简单此处省略. 项目描写叙述 调查是SharePoint中协同门户的一 ...

  9. erlang的汉字字符串和二进制的相互转换,并还原成汉字打印

    19> Hanzi = <<"汉字"/utf8>>. <<230,177,137,229,173,151>> 20> i ...

  10. ThinkPHP项目笔记之MVC篇

    题记:网上关于ThinkPHP的介绍,不计其数,有文档,示例,代码片段以及其他等.毕竟自己掌握的,才是自己的. 所以,趁着做的项目(当然用的是thinkphp框架)的余热,奋笔疾书,一个人的理解与拙笔 ...