摘要:Calculation 2Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2181Accepted Submission(s): 920Proble...
阅读全文
摘要:Fill the blanksTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 283Accepted Submission(s): 115Probl...
阅读全文
摘要:Just Pour the WaterTime Limit: 2 Seconds Memory Limit: 65536 KBShirly is a very clever girl. Now she has two containers (A and B), each with some wat...
阅读全文
摘要:LCM ExtremeTime Limit:3000msMemory Limit:131072KBThis problem will be judged on UVALive. Original ID:596464-bit integer IO format:%lld Java class name...
阅读全文
摘要:Another Easy ProblemTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionxtt最近学习了高斯消元法解方程组,现在他的问题来了,如果是以下的方程,那么应该如...
阅读全文
摘要:MultipleTime Limit:2 SecMemory Limit:64 MBSubmissions:197Solved:35DescriptionRocket323loves math very much. One day,Rocket323got a number string. He c...
阅读全文
摘要:#include#include#include#include#include#define MAXN 100000using namespace std;typedef unsigned long long LL;LL fac[MAXN],cnt,G,L,m,p;LL min(LL a,LL b){ return a>=1; } return ans;}LL pow_mod(LL a,LL b,LL mod){ LL d=1; a%=mod; while(b) { if(b&1) d=mult_mod(d,a,m...
阅读全文
摘要:表示还没理解过程,先贴个模版吧,套用在十进制下的求分数化小数的循环节答案不对。#include #includeusing namespace std;int gcd(int a,int b){ return b?gcd(b,a%b):a;}int euler(int n){ int phi=n; int top=n; for(int i=2;i*i1) phi=phi/n*(n-1); return phi;}int pow_mod(__int64 a,__int64 b,__int64 n){ __int64 t=1; a%=n; while...
阅读全文
摘要:题目大意:求n范围内最大的反素数(反素数定义:f(x)表示x的因子数,f(x)>f(x1) (0=p2>=......>=pn证明:若pi#includeusing namespace std;typedef long long LL;int prime[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};LL n,ans,Max;void dfs(LL sum,LL num,LL k,LL t){ if(sum>Max) {Max=sum;ans=num;} if(sum==Max && num14) retu
阅读全文
摘要:Emoogle GridYou have to color anMxN(1M,N108) two dimensional grid. You will be providedK(2K108) different colors to do so. You will also be provided a list ofB(0B500) list of blocked cells of this grid. You cannot color those blocked cells. A cell can be described as(x,y), which points to they-th ce
阅读全文
摘要:1426 - Discrete Square RootsTime limit: 3.000 secondsA square root of a numberxis a numberrsuch thatr2=x. A discrete square root of a non-negative integerxis a non-negative integerrsuch thatr2xmodN,0r, whereNis a specific positive integer and mod is the modulo operation.It is well-known that any pos
阅读全文
摘要:题目大意:给三个数A(进制)、B(如*****7的最后一个数字7)、C(*****7*4的后面的因数4)求符合条件下的第一个因数的位数最少例子:179487 * 4 = 717948 (10进制)注意到没7*4%10=8,8就是第一个因数的十位数字,进位7*4/10=2;第二个数字(8*4+2)%10=4,进位(8*4+2)/10=3;..........当一个数字等于B时,且前一个进位上来的值为0时候符合题意;AC 代码:#include#includeusing namespace std;int num,flag;int A,B,C;void dfs(int a,int b,int c,
阅读全文
摘要://题目大意:输入一个n值问洗牌n-1次后是不是会变成初始状态(Jimmy-number),从案例可看出牌1的位置变化为2^i%n,所以最终判断2^(n-1)=1(mod n)是否成立#include#include#include#includeusing namespace std;long long Montgomery(long long a,long long b,long long c){ long long t=1; while(b) { if(b%2) t=t*a%c; b/=2; a=a*a%c...
阅读全文
摘要:#include#include#include#includeusing namespace std;bool flag[50010];int prime[8000];bool r[1000010];int num;void Init(){ int i,j; num=0; memset(flag,true,sizeof(flag)); flag[1]=flag[0]=0; for(i=2;i>a>>b) { if(a==1) a++;//a=1的情况 min=20000000; max=0; mems...
阅读全文
摘要:MarblesInput:standard inputOutput:standard outputI have some (say,n) marbles (small glass balls) and I am going to buy some boxes to store them. The boxes are of two types:Type1: each box costsc1Taka and can hold exactlyn1marblesType2: each box costsc2Taka and can hold exactlyn2marblesI want each of
阅读全文
摘要:Huge ModInput:standard inputOutput:standard outputTime Limit:1 secondThe operator for exponentiation is different from the addition, subtraction, multiplication or division operators in the sense that the default associativity for exponentiation goes right to left instead of left to right. So unless
阅读全文
摘要:Problem G Power et al. Input:Standard InputOutput:Standard OutputFinding the exponent of any number can be very troublesome as it grows exponentiallyJ. But in this problem you will have to do a very simple task. Given two non-negative numbersmandn, you will have to find the last digit ofmnin decimal
阅读全文
摘要:Problem J GCD Extreme (II)Input:Standard InputOutput:Standard OutputGiven the value of N, you will have to find the value of G. The definition of G is...
阅读全文
摘要:C LooooopsTime Limit:1000MSMemory Limit:65536KTotal Submissions:14765Accepted:3719DescriptionA Compiler Mystery: We are given a C-language style for loop of typefor (variable = A; variable != B; variable += C) statement;I.e., a loop which starts by setting variable to value A and while variable is..
阅读全文
摘要:Strange Way to Express IntegersTime Limit:1000MSMemory Limit:131072KTotal Submissions:8005Accepted:2378DescriptionElina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following:Choosekdifferent positive integersa1,a2,…
阅读全文