25 Jun
http://www.comp.nus.edu.sg/~noi/tasks/2009/
http://www.comp.nus.edu.sg/~noi/tasks2001.html
http://www.comp.nus.edu.sg/~noi/tasks/2009/noi_tasks_2009.pdf
http://www.comp.nus.edu.sg/~noi/tasks2001.html
http://www.comp.nus.edu.sg/~noi/tasks/2009/noi_tasks_2009.pdf
#include
#include
#include
#include
using namespace std;
#include
#include
#include
using namespace std;
bool is_prime(int number) {
int i;
for (i=2;i<=sqrt(number);i++) {
if (number % i == 0) return 0;
}
return 1;
}
int i;
for (i=2;i<=sqrt(number);i++) {
if (number % i == 0) return 0;
}
return 1;
}
int main() {
int n,j,k;
k=1; j=2;
scanf (“%d”,&n);
while (k
int n,j,k;
k=1; j=2;
scanf (“%d”,&n);
while (k
/
FILE fin=fopen(“maxin1.txt”,”r”);
int main() {
int tmp,n,k;
n=0;
fscanf(fin,”%d”,&n);
int freq[10001]={0};
k=0;
while(fscanf(fin,”%d”,&tmp)) {
freq[tmp]++;
if (freq[tmp]>k) k=freq[tmp];
}
cout << k << endl;
return 0;
}
FILE fin=fopen(“maxin1.txt”,”r”);
int main() {
int tmp,n,k;
n=0;
fscanf(fin,”%d”,&n);
int freq[10001]={0};
k=0;
while(fscanf(fin,”%d”,&tmp)) {
freq[tmp]++;
if (freq[tmp]>k) k=freq[tmp];
}
cout << k << endl;
return 0;
}
/
22 Jun
/
// Program B
int counta,countb;
int curr;
counta = 0;
countb = 0;
while (counta < N) {
cin >> curr;
counta++;
if (curr > 5) {
countb++;
}
}
cout << countb;
return 0;
/
// Program B
int counta,countb;
int curr;
counta = 0;
countb = 0;
while (counta < N) {
cin >> curr;
counta++;
if (curr > 5) {
countb++;
}
}
cout << countb;
return 0;
// Program A
int x,y,count;
int s[50];
count = 0;
cin >> x >> y;
while ( y < x ) {
count++;
cin >> s[count];
y = s[count];
}
cout << y;
return 0;
int x,y,count;
int s[50];
count = 0;
cin >> x >> y;
while ( y < x ) {
count++;
cin >> s[count];
y = s[count];
}
cout << y;
return 0;
int n,curr,count,count2,max;
cin >> n;
max=0;
count2=0;
for (count=0; count> curr;
if (curr<0) {="" count2++;="" if="" (max="" <="" count2)="" max="count2;" }="" else="" count2="0;" cout="" <<="" endl;="" return="" 0;="" div="">
int f(int a,int b) {
//noi1999 task1-GCD
#include
#include
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
int main() {
int a,b,k,count;
count=0;
cin >> a >> b;
while (a>b || a
0)>
cin >> n;
max=0;
count2=0;
for (count=0; count
if (curr<0) {="" count2++;="" if="" (max="" <="" count2)="" max="count2;" }="" else="" count2="0;" cout="" <<="" endl;="" return="" 0;="" div="">
int f(int a,int b) {
}
int main() {
int x[100];
x[0]=0;
x[1]=1;
cin >> n;/
int x[100];
x[0]=0;
x[1]=1;
cin >> n;/
}
//0 1 1 2 3 5
//noi1999 task1-GCD
#include
#include
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
int main() {
int a,b,k,count;
count=0;
cin >> a >> b;
while (a>b || a
int f(int k) {
if (k==0) { return 0;}
else if (k==1) {return 1;}
else {return(k-1)+f(k-2);}
}
if (k==0) { return 0;}
else if (k==1) {return 1;}
else {return(k-1)+f(k-2);}
}
int main() {
int n;
cin >> n;
cout << f(n) << endl;
return 0;
}
int n;
cin >> n;
cout << f(n) << endl;
return 0;
}