摘要:Source : UnknownTime limit : 3 secMemory limit : 32 MSubmitted : 1227, Accepted: 383Consider the set of all reduced fractions between 0 and 1 inclusive with denominators less than or equal to N.Here is the set when N = 5:0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1Write a program that, given an integ
阅读全文
摘要:数星星Accepted : 63Submit : 245Time Limit : 1000 MSMemory Limit : 65536 KBDescription天空中一共有N颗星星,FF同学想知道天空中的一个矩形区域内有多少颗星星。我们把天空放到直角坐标系中,就可以得到每颗星星的坐标,假设每个星星的坐标都是整数。矩形区域我们用一个四元组表示(x1,y1,x2,y2)。x1,y1表示矩形左下角的坐标,x2,y2表示矩形右上角的坐标。现在请你回答FF同学提出的问题:矩形(x1,y1,x2,y2)内有多少颗星星(包括边界上的)。FF是个好问的同学,最多一次能提出10000个问题,请你用最快的速度
阅读全文
摘要:View Code #include <iostream>using namespace std;int a[5844];int min(int b,int c,int d,int e){ int t; t=b<c?b:c; t=t<d?t:d; t=t<e?t:e; return t;}int main(){ int i=0; a[i]=1; int x=0,y=0,z=0,m=0; while(i<=5843) { a[++i]=min(a[x]*2,a[y]*3,a[z]*5,a[m]*7); if(...
阅读全文
摘要:LottoTime Limit: 2 Seconds Memory Limit: 65536 KBIn a Lotto I have ever played, one has to select 6 numbers fromView Code #include <iostream>#include <algorithm>#include <fstream>using namespace std;int main(){ // ofstream cout("1.txt"); int a[20]; int n; int cae=0; while
阅读全文
摘要:1040: CountTime Limit: 1 SecMemory Limit: 128 MBSubmit: 2Solved: 2[Submit][Status][Web Board]DescriptionMany ACM team name may be very funny,such as "Complier_Error","VVVVV".Oh,wait for a minute here.Is it "W W"+"V",or "W"+"V V V",or someth
阅读全文
摘要:#include <iostream>using namespace std;struct s{int a[2][2];};int p;s work(s x,s y){s c;for (int i=0;i<2;i++){for (int j=0;j<2;j++){c.a[i][j]=0;for (int k=0;k<2;k++)c.a[i][j]+=x.a[i][k]*y.a[k][j];c.a[i][j]%=p;} }return c;}s mod(s t,int n){s m; if (n==0||n==1) {return t; }if (n%2){ m=m
阅读全文