10519 - !! Really Strange !!(数论+高精度)

option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1460" style="">题目链接

题目大意:给你n个圆,每两个圆都有相交的部分,而且相交的两个点都唯一的,不能再和别的圆交于这点。

问这样在一个矩形里的相交的n个圆能够产生多少个新的封闭图形。

看图会明确的。

解题思路:规律:f(n) = f(n - 1) + 2
∗(n
- 1) 最后推的 f(n) = n

(n - 1) + 2; (n >= 1), 0的时候要特判。n本身就是个大数,结果也是个大数。

代码:

import java.util.*;
import java.math.*;
import java.io.*; public class Main { public static void main(String args[]) { Scanner cin = new Scanner(System.in);
BigInteger n;
while (cin.hasNext()) { n = cin.nextBigInteger();
if (n.equals(BigInteger.ZERO))
System.out.println(1);
else
System.out.println(BigInteger.valueOf(2).add(n.multiply(n.subtract(BigInteger.valueOf(1)))));
}
}
}

UVA10519 - !! Really Strange !!(数论+高精度)的更多相关文章

  1. 数论 - 高精度Fibonacci数 --- UVa 10183 : How Many Fibs ?

    How many Fibs? Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := f n ...

  2. 2007Hanoi双塔问题

    题目描述 Description 给定A.B.C三根足够长的细柱,在A柱上放有2n个中间有孔的圆盘,共有n个不同的尺寸,每个尺寸都有两个相同的圆盘,注意这两个圆盘是不加区分的(下图为n=3的情形).现 ...

  3. 【BZOJ1876】[SDOI2009]SuperGCD(数论,高精度)

    [BZOJ1876][SDOI2009]SuperGCD(数论,高精度) 题面 BZOJ 洛谷 题解 那些说数论只会\(gcd\)的人呢?我现在连\(gcd\)都不会,谁来教教我啊? 显然\(gcd\ ...

  4. 数论F - Strange Way to Express Integers(不互素的的中国剩余定理)

    F - Strange Way to Express Integers Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format: ...

  5. Codeforces Round #425 (Div. 2) Problem C Strange Radiation (Codeforces 832C) - 二分答案 - 数论

    n people are standing on a coordinate axis in points with positive integer coordinates strictly less ...

  6. UVA 10303 - How Many Trees?(数论 卡特兰数 高精度)

    Problem D How Many Trees? Input: standard input Output: standard output Memory Limit: 32 MB A binary ...

  7. POJ 2891 Strange Way to Express Integers 中国剩余定理 数论 exgcd

    http://poj.org/problem?id=2891 题意就是孙子算经里那个定理的基础描述不过换了数字和约束条件的个数…… https://blog.csdn.net/HownoneHe/ar ...

  8. 【poj 2891】Strange Way to Express Integers(数论--拓展欧几里德 求解同余方程组 模版题)

    题意:Elina看一本刘汝佳的书(O_O*),里面介绍了一种奇怪的方法表示一个非负整数 m .也就是有 k 对 ( ai , ri ) 可以这样表示--m%ai=ri.问 m 的最小值. 解法:拓展欧 ...

  9. 专题[vjudge] - 数论0.1

    专题[vjudge] - 数论0.1 web-address : https://cn.vjudge.net/contest/176171 A - Mathematically Hard 题意就是定义 ...

随机推荐

  1. VB 中定义FileSystemObject对象,要先添加对象

     存取文件的方法有很多种,可以使用上述VB提供的函数,使用Windows API函数等等,但是最简单的方法是使用FileSystemObject对象. 1.使用FileSystemObject对象 F ...

  2. taro 不支持render中,使用函数多条件渲染

    不支持render中,使用函数多条件渲染 h5不报错,但是编译成小程序时 会报错 错误写法: onRenderContent = () => { const { verified, recogn ...

  3. validationEngine 表单验证插件使用

    废话少说,直接上代码,可拷贝直接运行: <!DOCTYPE html> <html lang="zh"> <head> <meta cha ...

  4. Java程序猿学习C++之数组和动态数组

    数组: #include <iostream> using namespace std; //模板函数 template <class T> void dump(T val) ...

  5. 解决win10鼠标晃动问题

    删除HKEY_CLASSES_ROOTDirectoryBackgroundshellexContextMenuHandlers 下面,除了new以外的文件夹 重启,Ok

  6. navicat ora-28547:connection to server failed

      navicat ora-28547:connection to server failed CreationTime--2018年8月9日18点47分 Author:Marydon 1.情景还原 ...

  7. CentOS6.3的VNC--远程桌面

    2G内存的服务器开启Gnome图形化界面应该没什么问题.1G还有512M的内存的就不敢开启了,现在内存正常状态就已经60%左右了. CentOS6.3服务器,Gnome图形化界面按照阿里官方步骤:一. ...

  8. 深入了解MyBatis参数

    参考1 参考2 参考3

  9. PHP原生实现,校验微信公众号||小程序服务器地址

    1.原生的.php文件:  test.php <?php header('Content-type:text'); define("TOKEN", "weixin& ...

  10. Java中entity(实体类)的写法规范

    在日常的Java项目开发中,entity(实体类)是必不可少的,它们一般都有很多的属性,并有相应的setter和getter方法.entity(实体类)的作用一般是和数据表做映射.所以快速写出规范的e ...