NEU 1495 a interesting game 大数 难度:1】的更多相关文章

问题 G: a interesting game 时间限制: 1 Sec  内存限制: 128 MB提交: 29  解决: 10[提交][状态][讨论版] 题目描述 One day,Kid is in class.But Kid think what the teacher teaching is so boring,so he decide to play a game with himself.He will give himself a matrix with n rows and m c…
题目链接:http://poj.org/problem?id=1503 import java.io.*; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String []args) throws IOException{ Scanner scanner=new Scanner(System.in); BigInteger a=BigIntege…
问题 I: Kid and Ants 时间限制: 1 Sec  内存限制: 128 MB提交: 42  解决: 33[提交][状态][讨论版] 题目描述 Kid likes interest question,although he don’t like ants so much. Assume there is a infinite long stick whose direction is from East to West. In addition, there are n ants on…
之前就保留过简陋的几个用外部数组变量实现的简单大数模板,也没有怎么用过,今天就想着整合封装一下,封装成C++的类,以后需要调用的时候也方便得多. 实现了基本的加减乘除和取模运算的操作符重载,大数除以大数难度太大就没实现,另外还实现了比较运算符,方便实际使用贴近内置类型的体验. 话不多说,贴代码. /*BigInt.h*/ #include <stdio.h> #include <string.h> #include <ctype.h> #define MAXBIT 10…
http://acm.hdu.edu.cn/showproblem.php?pid=1495 第三个杯子的盛水量可由前两个杯子得到,而前两个杯子状态总数在100*100以内,穷举可实现 #include <cstdio> #include <cstring> #include <queue> using namespace std; const int mxind=101; const int maxn=mxind*mxind; int n,m,s; int dp[ma…
111.Very simple problem time limit per test: 0.5 sec. memory limit per test: 4096 KB You are given natural number X. Find such maximum integer number that it square is not greater than X. Input Input file contains number X (1≤X≤101000). Output Write…
import java.math.BigInteger; import java.util.Scanner; public class Main { static BigInteger p,l,r,div; static int n; public static int cmp(BigInteger mid){ BigInteger sum=mid.pow(n); return sum.compareTo(p); } public static BigInteger calc(){ l=BigI…
问题 H: Planar map 时间限制: 1 Sec  内存限制: 128 MB提交: 24  解决: 22[提交][状态][讨论版] 题目描述 Tigher has work for a long time in a famous company.One day she is given a planar map(look at the following) and a point.The planar map can be regarded as a polygon.The planar…
112. a^b-b^a time limit per test: 0.25 sec. memory limit per test: 4096 KB You are given natural numbers a and b. Find a^b-b^a. Input Input contains numbers a and b (1≤a,b≤100). Output Write answer to output. Sample Input 2 3Sample Output -1 import j…
1495 中国好区间 基准时间限制:0.7 秒 空间限制:131072 KB 分值: 80 难度:5级算法题   阿尔法在玩一个游戏,阿尔法给出了一个长度为n的序列,他认为,一段好的区间,它的长度是>=k的,且该区间的第k大的那个数,一定大于等于T.那么问题来了,阿尔法想知道有多少好的区间. 由于阿尔法的序列长度实在是太大了,无法在规定时间内读入. 他想了一个绝妙的方法. 读入a[0],b,c,p,则a[i]=(a[i-1]*b+c)mod p. 样例解释: a1~a5分别为47,135,247…
http://acm.nyist.net/JudgeOnline/problem.php?pid=28 大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?   输入 输入一个整数m(0<m<=5000) 输出 输出m的阶乘,并在输出结束之后输入一个换行符 样例输入 50 样例输出 304140932017133780436126081660647688443776415…
比大小 时间限制:3000 ms  |  内存限制:65535 KB 难度:2   描述 给你两个很大的数,你能不能判断出他们两个数的大小呢? 比如123456789123456789要大于-123456   输入 每组测试数据占一行,输入两个不超过1000位的10进制整数a,b数据保证输入的a,b没有前缀的0.如果输入0 0表示输入结束.测试数据组数不超过10组 输出 如果a>b则输出“a>b”,如果a<b则输出“a<b”,如果相等则输出“a==b”. 样例输入 11111111…
大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?   输入 输入一个整数m(0<m<=5000) 输出 输出m的阶乘,并在输出结束之后输入一个换行符 样例输入 50 样例输出 30414093201713378043612608166064768844377641568960512000000000000 [代码] //NYOJ-28 大数阶乘 //直接开足够大的数组…
[正则] 正则表达式是一种文本模式,包括普通字符(例如,a 到 z 之间的字母)和特殊字符(称为“元字符”). 模式描述在搜索文本时要匹配的一个或多个字符串. 常用字符: //正则表达式 //$ 匹配输入字符串结尾的位置 //* 零次或多次匹配前面的字符或子表达式.例如,zo* 匹配“z”和“zoo”.* 等效于 {0,} //+ 一次或多次匹配前面的字符或子表达式.例如,“zo+”与“zo”和“zoo”匹配,但与“z”不匹配.+ 等效于 {1,}. //? 零次或一次匹配前面的字符或子表达式.…
1503:Integer Inquiry 总时间限制:  1000ms 内存限制:  65536kB 描述 One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers. ``This super…
A+B Problem IV 时间限制:1000 ms  |  内存限制:65535 KB 难度:3   描述 acmj最近发现在使用计算器计算高精度的大数加法时很不方便,于是他想着能不能写个程序把这个问题给解决了.   输入 包含多组测试数据每组数据包含两个正数A,B(可能为小数且位数不大于400) 输出 每组输出数据占一行,输出A+B的结果,结果需要是最简的形式. 样例输入 1.9 0.1 0.1 0.9 1.23 2.1 3 4.0 样例输出 2 1 3.33 7 //被JDK版本坑了,1…
1005 大数加法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 给出2个大整数A,B,计算A+B的结果. Input 第1行:大数A 第2行:大数B (A,B的长度 <= 10000 需注意:A B有可能为负数) Output 输出A + B Input示例 68932147586 468711654886 Output示例 537643802472 题目链接:http://www.51nod.com/onlineJudge/questionCode.html#…
1029 大数除法 基准时间限制:4 秒 空间限制:131072 KB 分值: 160 难度:6级算法题 给出2个大整数A,B,计算A / B和A Mod B的结果.   Input 第1行:大数A 第2行:大数B (A,B的长度 <= 100000,A,B >= 0) Output 第1行:A / B 第2行:A Mod B (A % B) Input示例 987654321 1234 Output示例 800368 209 题目链接:http://www.51nod.com/onlineJ…
1027 大数乘法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 给出2个大整数A,B,计算A*B的结果. Input 第1行:大数A 第2行:大数B (A,B的长度 <= 1000,A,B >= 0) Output 输出A * B Input示例 123456 234567 Output示例 28958703552 题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1027 分…
1028 大数乘法 V2 基准时间限制:2 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 给出2个大整数A,B,计算A*B的结果. Input 第1行:大数A 第2行:大数B (A,B的长度 <= 100000,A,B >= 0) Output 输出A * B Input示例 123456 234567 Output示例 28958703552 题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemI…
Sasha and Interesting Fact from Graph Theory n 个 点形成 m 个有标号森林的方案数为 F(n, m) = m * n ^ {n - 1 - m} 然后就没啥难度了... #include<bits/stdc++.h> #define LL long long #define LD long double #define ull unsigned long long #define fi first #define se second #defin…
题目链接:http://www.51nod.com/onlineJudge/submitDetail.html#!judgeId=620811 参考自:https://blog.csdn.net/f_zyj/article/details/51990962 1105 第K大的数 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 关注 数组A和数组B,里面都有n个整数. 数组C共有n^2个整数,分别是: A[0] * B[0],A[0] * B[1] ...…
1027 大数乘法 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题   给出2个大整数A,B,计算A*B的结果.   Input 第1行:大数A 第2行:大数B (A,B的长度 <= 1000,A,B >= 0) Output 输出A * B Input示例 123456 234567 Output示例 28958703552 #include <bits/stdc++.h> using namespace std; #define clear(A)…
Segment Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description     Silen August does not like to talk with others.She like to find some interesting problems. Today she finds an interesting problem.She…
大数阶乘 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 我们都知道如何计算一个数的阶乘,可是,如果这个数很大呢,我们该如何去计算它并输出它?   输入 输入一个整数m(0<m<=5000) 输出 输出m的阶乘,并在输出结束之后输入一个换行符 样例输入 50 样例输出 30414093201713378043612608166064768844377641568960512000000000000思路:模拟人工计算的方法计算:a b* c-----------…
光棍的yy 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描述 yy经常遇见一个奇怪的事情,每当他看时间的时候总会看见11:11,这个很纠结啊. 现在给你m个1,你可以把2个1组合成一个2,这样就不是光棍了,问这样的组合有多少种?? 例如(111  可以拆分为 111 12 21  有三种) 输入 第一行输入一个n表示有n个测试数据 以下n行,每行输入m个1 (1 <= n,m <= 200) 输出 输出这种组合种数,占一行 样例输入 3 11 111 11111 样…
光棍的yy 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描写叙述 yy常常遇见一个奇怪的事情.每当他看时间的时候总会看见11:11,这个非常纠结啊. 如今给你m个1,你能够把2个1组合成一个2,这样就不是光棍了.问这种组合有多少种?? 比如(111  能够拆分为 111 12 21  有三种) 输入 第一行输入一个n表示有n个測试数据 下面n行.每行输入m个1 (1 <= n,m <= 200) 输出 输出这样的组合种数,占一行 例子输入 3 11 111 1111…
Description On the evening of 3 August 1492, Christopher Columbus departed from Palos de la Frontera with a few ships, starting a serious of voyages of finding a new route to India. As you know, just in those voyages, Columbus discovered the America…
You must have heard that the Chinese culture is quite different from that of Europe or Russia. So some Chinese habits seem quite unusual or even weird to us. So it is known that there is one popular game of Chinese girls. N girls stand forming a circ…
1028 大数乘法 V2 基准时间限制:2 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 给出2个大整数A,B,计算A*B的结果.   Input 第1行:大数A 第2行:大数B (A,B的长度 <= 100000,A,B >= 0) Output 输出A * B Input示例 123456 234567 Output示例 28958703552 // 这题很有意思啊,c++写应该要 FFT ,但是python轻松水过,FFT还不会,先码住,以后可以当做测试题 A=int…