delete pics to save space
This commit is contained in:
10
history_source/ccf 入门篇/U1/1.1.cpp
Normal file
10
history_source/ccf 入门篇/U1/1.1.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
//1.1.1
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"I love programming"<<endl;
|
||||
while(true){;
|
||||
}
|
||||
return 0;
|
||||
}
|
11
history_source/ccf 入门篇/U1/1.2.cpp
Normal file
11
history_source/ccf 入门篇/U1/1.2.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
//1.1.1
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"<EFBFBD>С<EFBFBD>3.14"<<endl;
|
||||
cout<<"<EFBFBD><EFBFBD>= 3.14159265358979323846264338327950288<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
while(true){;
|
||||
}
|
||||
return 0;
|
||||
}
|
9
history_source/ccf 入门篇/U1/1.3.cpp
Normal file
9
history_source/ccf 入门篇/U1/1.3.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int w;
|
||||
w=90/3/3;
|
||||
cout<<"5̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>6<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<5*6*w<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
while(true);
|
||||
}
|
9
history_source/ccf 入门篇/U1/1.4.cpp
Normal file
9
history_source/ccf 入门篇/U1/1.4.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int w;
|
||||
w=100/4/5;
|
||||
cout<<"7<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>105<EFBFBD>ֲָ<EFBFBD>Ҫ<EFBFBD><EFBFBD>"<<105/7/w<<"<EFBFBD><EFBFBD>"<<endl;
|
||||
while(true);
|
||||
}
|
9
history_source/ccf 入门篇/U1/1.5.cpp
Normal file
9
history_source/ccf 入门篇/U1/1.5.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫȥ<EFBFBD><EFBFBD>"<<58%8<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
cout<<"ÿ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>"<<58/8<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
|
||||
while(true);
|
||||
}
|
9
history_source/ccf 入门篇/U1/1.6.cpp
Normal file
9
history_source/ccf 入门篇/U1/1.6.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long double d;
|
||||
d=0.6/5;
|
||||
cout<<"<EFBFBD><EFBFBD>16֧Ǧ<EFBFBD><EFBFBD>Ҫ"<<d*16<<"ԪǮ";
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U1/1.7.cpp
Normal file
7
history_source/ccf 入门篇/U1/1.7.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>791<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<3.2*791/2.8<<"<EFBFBD><EFBFBD>";
|
||||
while(true);
|
||||
}
|
15
history_source/ccf 入门篇/U1/1.8.cpp
Normal file
15
history_source/ccf 入门篇/U1/1.8.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long double size_;
|
||||
int s1;
|
||||
int s2;
|
||||
s1=10*8;
|
||||
s2=s1-16;
|
||||
size_=pow(s2,0.5);
|
||||
cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>ש<EFBFBD>߳<EFBFBD>"<<size_<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
while(true);
|
||||
}
|
||||
|
7
history_source/ccf 入门篇/U2/2.1.1.cpp
Normal file
7
history_source/ccf 入门篇/U2/2.1.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"ant\n_3cq\nmy\nfriend\nMycar\nmy_car\nall\na_abc\ndaf_32\nmaxn";
|
||||
while(true);
|
||||
}
|
16
history_source/ccf 入门篇/U2/2.1.2.cpp
Normal file
16
history_source/ccf 入门篇/U2/2.1.2.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a=998;
|
||||
float b=3.1415926535897;
|
||||
char c='a';
|
||||
double d=1.0/3;
|
||||
long double e=8.0/9;
|
||||
long f=999999999999999999999;
|
||||
cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl<<e<<endl<<f<<endl;
|
||||
|
||||
while(true);
|
||||
|
||||
return 0;
|
||||
}
|
8
history_source/ccf 入门篇/U2/2.1.3.cpp
Normal file
8
history_source/ccf 入门篇/U2/2.1.3.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
char a='b';
|
||||
cout<<a;
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U2/2.2.1.cpp
Normal file
7
history_source/ccf 入门篇/U2/2.2.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"B,C";
|
||||
while(true);
|
||||
}
|
11
history_source/ccf 入门篇/U2/2.2.2.cpp
Normal file
11
history_source/ccf 入门篇/U2/2.2.2.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"y=m*x+b"<<endl;
|
||||
cout<<"m=(a+b+c)/(e*f)"<<endl;
|
||||
cout<<"a=sqrt((x-3*y)*z)"<<endl;
|
||||
cout<<"a=(2*x-y)/(x+pow(y,2))"<<endl;
|
||||
cout<<"m=(x-y*z)/(2/c)";
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U2/2.2.3.cpp
Normal file
7
history_source/ccf 入门篇/U2/2.2.3.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"C,E,F";
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U2/2.2.4.cpp
Normal file
7
history_source/ccf 入门篇/U2/2.2.4.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"11\n9\n10\n9\n10\n10\n50\n21";
|
||||
while(true);
|
||||
}
|
8
history_source/ccf 入门篇/U2/2.2.5.cpp
Normal file
8
history_source/ccf 入门篇/U2/2.2.5.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"4 3 4\n4 4 3"<<endl<<endl<<"==========="<<endl;
|
||||
cout<<"2 1";
|
||||
while(true);
|
||||
}
|
10
history_source/ccf 入门篇/U2/2.2.6.cpp
Normal file
10
history_source/ccf 入门篇/U2/2.2.6.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"ceil(3.14)="<<ceil(3.14)<<" floor(3.14)="<<floor(3.14)<<endl;
|
||||
cout<<"4^3.0="<<pow(4,3.0)<<endl;
|
||||
cout<<"sqrt(9)="<<sqrt(9)<<endl;
|
||||
while(true);
|
||||
}
|
9
history_source/ccf 入门篇/U2/2.2.7.cpp
Normal file
9
history_source/ccf 入门篇/U2/2.2.7.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int m=540/(120+150);
|
||||
cout<<"<EFBFBD><EFBFBD><EFBFBD>꼶<EFBFBD>ֵ<EFBFBD>"<<m*120<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
cout<<"<EFBFBD><EFBFBD><EFBFBD>꼶<EFBFBD>ֵ<EFBFBD>"<<m*150<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
while(true);
|
||||
}
|
9
history_source/ccf 入门篇/U2/2.2.8.cpp
Normal file
9
history_source/ccf 入门篇/U2/2.2.8.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
cin>>a>>b;
|
||||
cout<<a<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<b<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<a%b;
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U2/2.3.1.cpp
Normal file
7
history_source/ccf 入门篇/U2/2.3.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"3 3\n3 8\n11 8\nc=1\nc=1.375\n";
|
||||
while(true);
|
||||
}
|
21
history_source/ccf 入门篇/U2/2.3.2.cpp
Normal file
21
history_source/ccf 入门篇/U2/2.3.2.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
char a;
|
||||
string x;
|
||||
stringstream b;
|
||||
b.flush();
|
||||
cin>>x;
|
||||
for(int i=0;i<x.size();i++){
|
||||
a=x[i];
|
||||
a=219-a;
|
||||
b<<a;
|
||||
}
|
||||
x="";
|
||||
b>>x;
|
||||
cout<<x<<endl;
|
||||
while(1==1);
|
||||
}
|
21
history_source/ccf 入门篇/U2/2.3.3.cpp
Normal file
21
history_source/ccf 入门篇/U2/2.3.3.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
char a;
|
||||
string x;
|
||||
stringstream b;
|
||||
b.flush();
|
||||
cin>>x;
|
||||
for(int i=0;i<x.size();i++){
|
||||
a=x[i];
|
||||
a=97+(a-97+17)%24;
|
||||
b<<a;
|
||||
}
|
||||
x="";
|
||||
b>>x;
|
||||
cout<<x<<endl;
|
||||
while(1==1);
|
||||
}
|
10
history_source/ccf 入门篇/U2/2.4.1.cpp
Normal file
10
history_source/ccf 入门篇/U2/2.4.1.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
float a;
|
||||
while(true){
|
||||
cin>>a;
|
||||
cout<<a<<"<EFBFBD>H"<<"="<<(a-32)/1.8<<"<EFBFBD><EFBFBD>"<<endl;
|
||||
}
|
||||
}
|
12
history_source/ccf 入门篇/U2/2.4.2.cpp
Normal file
12
history_source/ccf 入门篇/U2/2.4.2.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
float a,b,c,p;
|
||||
while(true){
|
||||
cin>>a>>b>>c;
|
||||
p=(a+b+c)/2.0;
|
||||
cout<<"S="<<sqrt(p*(p-a)*(p-b)*(p-c))<<endl;
|
||||
}
|
||||
}
|
11
history_source/ccf 入门篇/U2/2.4.3.cpp
Normal file
11
history_source/ccf 入门篇/U2/2.4.3.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a;
|
||||
while(true){
|
||||
cin>>a;
|
||||
a=a*1001;
|
||||
cout<<a/7/11/13<<endl;
|
||||
}
|
||||
}
|
15
history_source/ccf 入门篇/U2/2.5.1.cpp
Normal file
15
history_source/ccf 入门篇/U2/2.5.1.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"a=202"<<endl;
|
||||
cout<<"2*a=404"<<endl;
|
||||
cout<<"a=202"<<endl;
|
||||
cout<<"2323.343450"<<endl;
|
||||
cout<<" 2323.34"<<endl;
|
||||
cout<<"2323.34"<<endl;
|
||||
cout<<"2323.34"<<endl;
|
||||
cout<<"============"<<endl<<endl;
|
||||
cout<<"1, 1,001,123,123 ,00123";
|
||||
while(true);
|
||||
}
|
13
history_source/ccf 入门篇/U2/2.6.1.cpp
Normal file
13
history_source/ccf 入门篇/U2/2.6.1.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include<iostream>
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,n,m;
|
||||
cin>>n>>m>>a;
|
||||
int x,y;
|
||||
x=n/a;
|
||||
y=m/a;
|
||||
cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<x*y<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
while(true);
|
||||
}
|
13
history_source/ccf 入门篇/U2/2.6.2.cpp
Normal file
13
history_source/ccf 入门篇/U2/2.6.2.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include<iostream>
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
while(true){
|
||||
double R,X,P;
|
||||
cin>>X>>R>>P;
|
||||
cout<<P<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ"<<X*pow(1+R/100.0,P)<<endl;
|
||||
}
|
||||
|
||||
}
|
13
history_source/ccf 入门篇/U2/2.6.3.cpp
Normal file
13
history_source/ccf 入门篇/U2/2.6.3.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include<iostream>
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double a,b,c,d;
|
||||
while(true){
|
||||
cin>>a>>b>>c;
|
||||
d=20-a-b-c;
|
||||
printf("<EFBFBD><EFBFBD>Ӧȥ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>%G<><47><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ʯͷ\n",d);
|
||||
}
|
||||
}
|
21
history_source/ccf 入门篇/U2/2.6.4.cpp
Normal file
21
history_source/ccf 入门篇/U2/2.6.4.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int i=0;
|
||||
double a,b;
|
||||
while(true){
|
||||
cin>>a>>b;
|
||||
if(a<b)cout<<a<<" % "<<b<<"="<<a;
|
||||
else{
|
||||
if(a==b)cout<<a<<" % "<<b<<"="<<0;
|
||||
else{
|
||||
for(i=1;i*b<a;i++);
|
||||
cout<<a<<" % "<<b<<"="<<a-b*(i-1);
|
||||
}
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
15
history_source/ccf 入门篇/U2/2.6.5.cpp
Normal file
15
history_source/ccf 入门篇/U2/2.6.5.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
#include<cstdlib>
|
||||
#include<ctime>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
srand(time(0));
|
||||
int a,b,c;
|
||||
a=rand()%1000000+1;
|
||||
b=rand()%1000000+1;
|
||||
c=rand()%1000000+1;
|
||||
cout<<a<<"-"<<b<<"+"<<c<<"+"<<c<<"*("<<a<<"-"<<b<<")="<<a-b+c+c*(a-b)<<endl;
|
||||
while(true);
|
||||
}
|
12
history_source/ccf 入门篇/U3/3.1.1(1).cpp
Normal file
12
history_source/ccf 入门篇/U3/3.1.1(1).cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
cout<<"a,b=";
|
||||
cin>>a>>b;
|
||||
if(a=b)cout<<a;
|
||||
else cout<<"Unequal";
|
||||
while(true);
|
||||
}
|
12
history_source/ccf 入门篇/U3/3.1.1(2).cpp
Normal file
12
history_source/ccf 入门篇/U3/3.1.1(2).cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
cout<<"a,b=";
|
||||
cin>>a>>b;
|
||||
if(a==b)cout<<a;
|
||||
else cout<<"Unequal";
|
||||
while(true);
|
||||
}
|
16
history_source/ccf 入门篇/U3/3.1.2(1).cpp
Normal file
16
history_source/ccf 入门篇/U3/3.1.2(1).cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b,c=0,d=0;
|
||||
cout<<"a,b=";
|
||||
cin>>a>>b;
|
||||
if(a>b)
|
||||
{
|
||||
c=a/b;
|
||||
d=a%b;
|
||||
}
|
||||
cout<<c+d;
|
||||
while(true);
|
||||
}
|
14
history_source/ccf 入门篇/U3/3.1.2(2).cpp
Normal file
14
history_source/ccf 入门篇/U3/3.1.2(2).cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b,c=0,d=0;
|
||||
cout<<"a,b=";
|
||||
cin>>a>>b;
|
||||
if(a>b)
|
||||
c=a/b;
|
||||
d=a%b;
|
||||
cout<<c+d;
|
||||
while(true);
|
||||
}
|
16
history_source/ccf 入门篇/U3/3.1.3.cpp
Normal file
16
history_source/ccf 入门篇/U3/3.1.3.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,a,b,c,m;
|
||||
while(true){
|
||||
cin>>n;
|
||||
a=n/100;
|
||||
b=n/10-a*10;
|
||||
c=n-a*100-b*10;
|
||||
m=a*a*a+b*b*b+c*c*c;
|
||||
if(n==m)cout<<"Yes"<<endl;
|
||||
else cout<<"No"<<endl;
|
||||
}
|
||||
}
|
17
history_source/ccf 入门篇/U3/3.2.1.cpp
Normal file
17
history_source/ccf 入门篇/U3/3.2.1.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int b,g;
|
||||
while(true)
|
||||
{
|
||||
cin>>b>>g;
|
||||
if((b+g)<10) cout<<"water"<<endl;
|
||||
else{
|
||||
if(b>g) cout<<"tree"<<endl;
|
||||
else cout<<"tea"<<endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
18
history_source/ccf 入门篇/U3/3.2.2.cpp
Normal file
18
history_source/ccf 入门篇/U3/3.2.2.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int g;
|
||||
while(true)
|
||||
{
|
||||
cin>>g;
|
||||
if(!(g>30))
|
||||
{
|
||||
if(g<=10) cout<<"<EFBFBD><EFBFBD>Ҫ "<<0.8*g<<"Ԫ"<<endl;
|
||||
if(g>10&&g<=20) cout<<"<EFBFBD><EFBFBD>Ҫ "<<0.75*g<<"Ԫ"<<endl;
|
||||
if(g>20&&g<=30) cout<<"<EFBFBD><EFBFBD>Ҫ "<<0.7*g<<"Ԫ"<<endl;
|
||||
}
|
||||
else cout<<"<EFBFBD><EFBFBD><EFBFBD>ʼģ<EFBFBD>"<<endl;
|
||||
}
|
||||
}
|
15
history_source/ccf 入门篇/U3/3.2.3.cpp
Normal file
15
history_source/ccf 入门篇/U3/3.2.3.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int x,y;
|
||||
while(true)
|
||||
{
|
||||
cin>>x>>y;
|
||||
x=abs(x);
|
||||
y=abs(y);
|
||||
if(x<=1&&y<=1) cout<<"Yes"<<endl;
|
||||
else cout<<"No"<<endl;
|
||||
}
|
||||
}
|
20
history_source/ccf 入门篇/U3/3.2.4.cpp
Normal file
20
history_source/ccf 入门篇/U3/3.2.4.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a;
|
||||
while(true)
|
||||
{
|
||||
cin>>a;
|
||||
if((a%123>=97)&&(a%123<=122)) cout<<char(a%123)<<endl;
|
||||
else
|
||||
{
|
||||
if((a%91>=65)&&(a%91<=90)) cout<<char(a%91)<<endl;
|
||||
else
|
||||
{
|
||||
cout<<"*"<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
history_source/ccf 入门篇/U3/3.3.1.cpp
Normal file
11
history_source/ccf 入门篇/U3/3.3.1.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"A:"<<endl;
|
||||
cout<<"B:x=2"<<endl;
|
||||
cout<<"C:z =7"<<endl;
|
||||
cout<<"D:x=2"<<endl;
|
||||
cout<<"E:z =6";
|
||||
while(true);
|
||||
}
|
21
history_source/ccf 入门篇/U3/3.3.2.cpp
Normal file
21
history_source/ccf 入门篇/U3/3.3.2.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
float a,b,c;
|
||||
while(true)
|
||||
{
|
||||
cin>>a>>b>>c;
|
||||
if(!((a+b>c)&&(a+c>b)&&(b+c>a))) cout<<"No!"<<endl;
|
||||
else
|
||||
{
|
||||
if(a==b&&a==c) cout<<"<EFBFBD>ȱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
else
|
||||
{
|
||||
if((a*a+b*b==c*c)||(a*a+c*c==b*b)||(b*b+c*c==a*a)) cout<<"ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
else cout<<"һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
21
history_source/ccf 入门篇/U3/3.3.3.cpp
Normal file
21
history_source/ccf 入门篇/U3/3.3.3.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int f;
|
||||
while(true)
|
||||
{
|
||||
cin>>f;
|
||||
if(f>90) cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
else
|
||||
{
|
||||
if(f/10==8) cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
else
|
||||
{
|
||||
if(f>=60&&f<80) cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
else cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6
history_source/ccf 入门篇/U3/3.4.1.cpp
Normal file
6
history_source/ccf 入门篇/U3/3.4.1.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
|
||||
}
|
22
history_source/ccf 入门篇/U3/3.4.2.cpp
Normal file
22
history_source/ccf 入门篇/U3/3.4.2.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a;
|
||||
while(true)
|
||||
{
|
||||
cin>>a;
|
||||
switch(a)
|
||||
{
|
||||
case 1:cout<<"Monday"<<endl;break;
|
||||
case 2:cout<<"Tuesday"<<endl;break;
|
||||
case 3:cout<<"Wednesday"<<endl;break;
|
||||
case 4:cout<<"Thursday"<<endl;break;
|
||||
case 5:cout<<"Friday"<<endl;break;
|
||||
case 6:cout<<"Saturday"<<endl;break;
|
||||
case 7:cout<<"Sunday"<<endl;break;
|
||||
default:cout<<"Sorry!"<<endl;
|
||||
}
|
||||
}
|
||||
}
|
40
history_source/ccf 入门篇/U3/3.4.3.cpp
Normal file
40
history_source/ccf 入门篇/U3/3.4.3.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int y,m;
|
||||
bool p()
|
||||
{
|
||||
if(y%400==0) return 1;
|
||||
if(y%100==0) return 0;
|
||||
if(y%4==0) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
while(true)
|
||||
{
|
||||
cin>>y>>m;
|
||||
switch(m)
|
||||
{
|
||||
case 1:cout<<"31days"<<endl;break;
|
||||
case 2:{
|
||||
if(p())cout<<"29days"<<endl;
|
||||
else cout<<"28days"<<endl;
|
||||
break;
|
||||
}
|
||||
case 3:cout<<"31days"<<endl;break;
|
||||
case 4:cout<<"30days"<<endl;break;
|
||||
case 5:cout<<"31days"<<endl;break;
|
||||
case 6:cout<<"30days"<<endl;break;
|
||||
case 7:cout<<"31days"<<endl;break;
|
||||
case 8:cout<<"31days"<<endl;break;
|
||||
case 9:cout<<"30days"<<endl;break;
|
||||
case 10:cout<<"31days"<<endl;break;
|
||||
case 11:cout<<"30days"<<endl;break;
|
||||
case 12:cout<<"31days"<<endl;break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
22
history_source/ccf 入门篇/U3/3.4.4.cpp
Normal file
22
history_source/ccf 入门篇/U3/3.4.4.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a;
|
||||
while(true)
|
||||
{
|
||||
cout<<"[1]apples"<<endl<<"[2]pears"<<endl<<"[3]oranges"<<endl<<"[4]grapes"<<endl<<"[0]Exit"<<endl;
|
||||
cin>>a;
|
||||
cout<<"price= ";
|
||||
switch(a)
|
||||
{
|
||||
case 1:cout<<3.0;break;
|
||||
case 2:cout<<2.5;break;
|
||||
case 3:cout<<4.2;break;
|
||||
case 4:cout<<10.2;break;
|
||||
case 0:return 0;
|
||||
default:cout<<0;
|
||||
}
|
||||
cout<<endl<<endl;
|
||||
}
|
||||
}
|
12
history_source/ccf 入门篇/U3/3.5.1.cpp
Normal file
12
history_source/ccf 入门篇/U3/3.5.1.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long double x;
|
||||
while(true)
|
||||
{
|
||||
cin>>x;
|
||||
if(x=0.5) cout<<"0.5 min"<<endl;
|
||||
else cout<<(x-0.5)/0.2+3<<" min"<<endl;
|
||||
}
|
||||
}
|
20
history_source/ccf 入门篇/U3/3.5.2.cpp
Normal file
20
history_source/ccf 入门篇/U3/3.5.2.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long double a;
|
||||
while(true)
|
||||
{
|
||||
cin>>a;
|
||||
if(a>=0&&a<5) cout<<a+2.5<<endl;
|
||||
else
|
||||
{
|
||||
if(a>=5&&a<10) cout<<2-1.5*(a-3)*(a-3)<<endl;
|
||||
else
|
||||
{
|
||||
if(a>=10&&a<20) cout<<a/2-1.5<<endl;
|
||||
else cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч!"<<endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
history_source/ccf 入门篇/U3/3.5.3.cpp
Normal file
24
history_source/ccf 入门篇/U3/3.5.3.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
string a;
|
||||
while(true)
|
||||
{
|
||||
cin>>a;
|
||||
cout<<a<<"<EFBFBD><EFBFBD>"<<a.size()<<"λ<EFBFBD><EFBFBD>"<<endl;
|
||||
for(int i=0;i<a.size();i++)
|
||||
{
|
||||
switch(i+1)
|
||||
{
|
||||
case 1:cout<<"<EFBFBD><EFBFBD>λ ";break;
|
||||
case 2:cout<<"ʮλ ";break;
|
||||
case 3:cout<<"<EFBFBD><EFBFBD>λ ";break;
|
||||
case 4:cout<<"ǧλ ";break;
|
||||
}
|
||||
cout<<a[a.size()-i-1]<<endl;
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
16
history_source/ccf 入门篇/U3/3.5.4.cpp
Normal file
16
history_source/ccf 入门篇/U3/3.5.4.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double i;
|
||||
while(true)
|
||||
{
|
||||
cin>>i;
|
||||
if(i<=10){ cout<<((int) i*0.1/1000)*1000;continue; }
|
||||
if(i>10&&i<20){ cout<<((int) (10*0.1+(i-10)*0.75)/1000)*1000;continue; }
|
||||
if(i>=20&&i<40){ cout<<((int) (10*0.1+10*0.075+(i-20)*0.05)/1000)*1000;continue; }
|
||||
if(i>=40&&i<60){ cout<<((int) (10*0.1+10*0.075+20*0.05+(i-40)*0.03)/1000)*1000;continue; }
|
||||
if(i>=60&&i<100){ cout<<((int) (10*0.1+10*0.075+20*0.05+20*0.03+(i-60)*0.015)/1000)*1000;continue; }
|
||||
if(i>100){ cout<<((int) (10*0.1+10*0.075+20*0.05+20*0.03+40*0.015+(i-100)*0.01)/1000)*1000;continue; }
|
||||
}
|
||||
}
|
7
history_source/ccf 入门篇/U4/4.1.1.cpp
Normal file
7
history_source/ccf 入门篇/U4/4.1.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"0\n\n25\n\n1#\n2$\n3\n4\n5\n\n25:28\n67:70";
|
||||
while(true);
|
||||
}
|
25
history_source/ccf 入门篇/U4/4.1.2.cpp
Normal file
25
history_source/ccf 入门篇/U4/4.1.2.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long double s=1;
|
||||
for(int i=2;i<=100;i++)
|
||||
{
|
||||
if(i%2==1) s=s-i;
|
||||
else s=s+i;
|
||||
}
|
||||
cout<<int(s)<<endl;
|
||||
s=0;
|
||||
for(int i=1;i<=10;i++)
|
||||
{
|
||||
s=s+i*(11-i);
|
||||
}
|
||||
cout<<int(s)<<endl;
|
||||
s=0;
|
||||
for(int i=1;i<=100;i++)
|
||||
{
|
||||
s=s+1.0/i;
|
||||
}
|
||||
cout<<s;
|
||||
while(true);
|
||||
}
|
15
history_source/ccf 入门篇/U4/4.1.3.cpp
Normal file
15
history_source/ccf 入门篇/U4/4.1.3.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
float n,s,p;
|
||||
cin>>n;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
cin>>p;
|
||||
s=s+p;
|
||||
}
|
||||
p=s/n;
|
||||
cout<<int(p*100.0)/100.0;
|
||||
while(true);
|
||||
}
|
20
history_source/ccf 入门篇/U4/4.1.4.cpp
Normal file
20
history_source/ccf 入门篇/U4/4.1.4.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
|
||||
int n,b,s,a;
|
||||
cin>>n;
|
||||
cin>>s;
|
||||
b=s+1;
|
||||
for(int i=0;i<n-1;i++)
|
||||
{
|
||||
cin>>a;
|
||||
if(a>b) b=a;
|
||||
else if(a<s) s=a;
|
||||
}
|
||||
cout<<b-s<<endl<<endl;
|
||||
}
|
||||
}
|
15
history_source/ccf 入门篇/U4/4.1.5.cpp
Normal file
15
history_source/ccf 入门篇/U4/4.1.5.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
unsigned long long s;
|
||||
s=1;
|
||||
for(int i=1;i<64;i++)
|
||||
{
|
||||
s=s+s*2;
|
||||
}
|
||||
long double t;
|
||||
t=s/142000000;
|
||||
cout<<t;
|
||||
while(true);
|
||||
}
|
18
history_source/ccf 入门篇/U4/4.1.6.cpp
Normal file
18
history_source/ccf 入门篇/U4/4.1.6.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
int s;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
s=0;
|
||||
for(int i=1;i*i<=n;i++)
|
||||
{
|
||||
if(n%i==0) s=s+2;
|
||||
if(i*i==n) s=s-1;
|
||||
}
|
||||
cout<<s<<endl;
|
||||
}
|
||||
}
|
21
history_source/ccf 入门篇/U4/4.1.7.cpp
Normal file
21
history_source/ccf 入门篇/U4/4.1.7.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,a,b,c,a1,b1,c1;
|
||||
while(true)
|
||||
{
|
||||
a=0;
|
||||
b=0;
|
||||
c=0;
|
||||
cin>>n;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
cin>>a1>>b1>>c1;
|
||||
a+=a1;
|
||||
b+=b1;
|
||||
c+=c1;
|
||||
}
|
||||
cout<<a<<" "<<b<<" "<<c<<" "<<a+b+c<<endl<<endl;
|
||||
}
|
||||
}
|
20
history_source/ccf 入门篇/U4/4.1.8.cpp
Normal file
20
history_source/ccf 入门篇/U4/4.1.8.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b,s,f;
|
||||
while(true)
|
||||
{
|
||||
cin>>s;
|
||||
b=s+1;
|
||||
a=a+s;
|
||||
for(int i=0;i<9;i++)
|
||||
{
|
||||
cin>>f;
|
||||
if(f>b) b=f;
|
||||
if(f<s) s=f;
|
||||
a=a+f;
|
||||
}
|
||||
cout<<(a-b-s)/8.0<<endl<<endl;
|
||||
}
|
||||
}
|
17
history_source/ccf 入门篇/U4/4.1.9.cpp
Normal file
17
history_source/ccf 入门篇/U4/4.1.9.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int m,t,f;
|
||||
while(true)
|
||||
{
|
||||
m=0;
|
||||
cin>>t;
|
||||
for(int i=0;i<10;i++)
|
||||
{
|
||||
cin>>f;
|
||||
if(t+30>=f) m++;
|
||||
}
|
||||
cout<<m<<endl<<endl;
|
||||
}
|
||||
}
|
7
history_source/ccf 入门篇/U4/4.2.1.cpp
Normal file
7
history_source/ccf 入门篇/U4/4.2.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"0 4201 987654321\n\n000 \n\n50 1 1";
|
||||
while(true);
|
||||
}
|
26
history_source/ccf 入门篇/U4/4.2.2.cpp
Normal file
26
history_source/ccf 入门篇/U4/4.2.2.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int f,i,s,a;
|
||||
while(true)
|
||||
{
|
||||
i=0;
|
||||
s=0;
|
||||
cin>>f;
|
||||
while(true)
|
||||
{
|
||||
a=f;
|
||||
a=a/pow(10,i);
|
||||
if(a==0) break;
|
||||
else
|
||||
{
|
||||
a=a%10;
|
||||
s=s+a;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
cout<<s<<endl;
|
||||
}
|
||||
}
|
17
history_source/ccf 入门篇/U4/4.2.3.cpp
Normal file
17
history_source/ccf 入门篇/U4/4.2.3.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int m,n,b,i;
|
||||
while(true)
|
||||
{
|
||||
cin>>m>>n;
|
||||
b=(m>n)?m:n;
|
||||
for(i=2;i<=b;i++)
|
||||
{
|
||||
if(m%i==0&&n%i==0) {cout<<"No"<<endl;break;}
|
||||
}
|
||||
if(!(m%i==0&&n%i==0)) cout<<"Yes"<<endl;
|
||||
}
|
||||
}
|
20
history_source/ccf 入门篇/U4/4.2.4.cpp
Normal file
20
history_source/ccf 入门篇/U4/4.2.4.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
string j;
|
||||
stringstream num;
|
||||
int s,b,n;
|
||||
while(true)
|
||||
{
|
||||
cin>>s>>b;
|
||||
n=0;
|
||||
num.flush();
|
||||
for(int i=0;i<b-s+1;i++) num<<s+i;
|
||||
num>>j;
|
||||
for(int i=0;i<j.size();i++) if(j[i]=='2') n++;
|
||||
cout<<n<<endl;
|
||||
}
|
||||
}
|
48
history_source/ccf 入门篇/U4/4.2.5.cpp
Normal file
48
history_source/ccf 入门篇/U4/4.2.5.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int k;
|
||||
long long n;
|
||||
long double f(long long n)
|
||||
{
|
||||
long double s=0;
|
||||
for(int i=1;i<=n;i++)
|
||||
{
|
||||
s=s+1.0/i;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
cin>>k;
|
||||
if(k>=10) n=pow(k,4);
|
||||
else{
|
||||
if(k>=6) n=pow(k,3);
|
||||
else n=k*k;
|
||||
}
|
||||
if(k<12){
|
||||
while(f(n)<=k)n+=3;
|
||||
if(f(n-1)>k)
|
||||
{if(f(n-2)>k) cout<<n-2<<endl;
|
||||
else cout<<n-1<<endl;}
|
||||
else cout<<n<<endl;}
|
||||
else {
|
||||
if(k>=14) n=pow(k,5);
|
||||
if(k>=15) while(f(n)<=k) n+=4096;
|
||||
else while(f(n)<=k) n+=2048;
|
||||
if(f(n-2048)>k) n-=2048;
|
||||
if(f(n-1024)>k) n-=1024;
|
||||
if(f(n-512)>k) n-=512;
|
||||
if(f(n-256)>k) n-=256;
|
||||
if(f(n-128)>k) n-=128;
|
||||
if(f(n-64)>k) n-=64;
|
||||
if(f(n-32)>k) n-=32;
|
||||
if(f(n-16)>k) n-=16;
|
||||
while(f(n)>k) n--;
|
||||
n++;
|
||||
cout<<n<<endl;
|
||||
}
|
||||
}
|
||||
}
|
21
history_source/ccf 入门篇/U4/4.2.6.cpp
Normal file
21
history_source/ccf 入门篇/U4/4.2.6.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
#include<string>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
string a;
|
||||
char f;
|
||||
while(true)
|
||||
{
|
||||
cin>>a;
|
||||
for(int i=0;i<a.size();i++)
|
||||
{
|
||||
f=a[i];
|
||||
if(f>='A'&&f<='Z') f=(f-'A'+3)%26+'A';
|
||||
if(f>='a'&&f<='z') f=(f-'a'+3)%26+'a';
|
||||
cout<<f;
|
||||
}
|
||||
cout<<endl<<endl;
|
||||
}
|
||||
}
|
7
history_source/ccf 入门篇/U4/4.3.1.cpp
Normal file
7
history_source/ccf 入门篇/U4/4.3.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"001 0\n\n50 1 0\n\n8";
|
||||
while(true);
|
||||
}
|
17
history_source/ccf 入门篇/U4/4.3.2.cpp
Normal file
17
history_source/ccf 入门篇/U4/4.3.2.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long double pi4=0;
|
||||
long long n=1,j=1;
|
||||
do
|
||||
{
|
||||
if(j%2==1) pi4=pi4+1.0/n;
|
||||
else pi4=pi4-1.0/n;
|
||||
n+=2;
|
||||
j++;
|
||||
}while(1.0/n>=0.000001);
|
||||
cout<<pi4*4.0;
|
||||
while(true);
|
||||
}
|
14
history_source/ccf 入门篇/U4/4.3.3.cpp
Normal file
14
history_source/ccf 入门篇/U4/4.3.3.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double l=200,s=0;
|
||||
do
|
||||
{
|
||||
s=s+l;
|
||||
l/=2;
|
||||
} while(l>=0.5);
|
||||
cout<<s;
|
||||
while(true);
|
||||
}
|
27
history_source/ccf 入门篇/U4/4.3.4.cpp
Normal file
27
history_source/ccf 入门篇/U4/4.3.4.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include<iostream>
|
||||
#include<string>
|
||||
#include<sstream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
stringstream num;
|
||||
string j;
|
||||
int a,b;
|
||||
bool z,x;
|
||||
while(true)
|
||||
{
|
||||
cin>>a;
|
||||
z=0;
|
||||
if(a<0){z=1;a=abs(a);}
|
||||
b=0;
|
||||
do
|
||||
{
|
||||
b=b*10+a%10;
|
||||
a/=10;
|
||||
}while(a>0);
|
||||
a=b;
|
||||
if(z==1) a=0-a;
|
||||
cout<<a<<endl;
|
||||
}
|
||||
}
|
32
history_source/ccf 入门篇/U4/4.3.5.cpp
Normal file
32
history_source/ccf 入门篇/U4/4.3.5.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int x=1,y=1,n;
|
||||
scanf("%d",&n);
|
||||
bool f=1;
|
||||
for(int i=1;i<n;i++)
|
||||
{
|
||||
if(f)
|
||||
{
|
||||
if(y>1) y--,x++;
|
||||
else
|
||||
{
|
||||
f=0;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(x>1) x--,y++;
|
||||
else
|
||||
{
|
||||
f=1;
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("%d/%d\n",y,x);
|
||||
return 0;
|
||||
}
|
||||
|
18
history_source/ccf 入门篇/U4/4.3.6.cpp
Normal file
18
history_source/ccf 入门篇/U4/4.3.6.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,a;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
a=1;
|
||||
while(n!=1)
|
||||
{
|
||||
if(n%2==0) n/=2;
|
||||
else n=3*n+1;
|
||||
a++;
|
||||
}
|
||||
cout<<a<<endl;
|
||||
}
|
||||
}
|
18
history_source/ccf 入门篇/U4/4.4.2.cpp
Normal file
18
history_source/ccf 入门篇/U4/4.4.2.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
for(int a=0;a<(n*2-1-i*2-1)/2;a++) cout<<" ";
|
||||
for(int a=0;a<i*2+1;a++) cout<<"*";
|
||||
for(int a=0;a<(n*2-1-i*2-1)/2;a++) cout<<" ";
|
||||
cout<<endl;
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
25
history_source/ccf 入门篇/U4/4.4.3.cpp
Normal file
25
history_source/ccf 入门篇/U4/4.4.3.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
for(int a=0;a<(n*2-1-i*2-1)/2;a++) cout<<" ";
|
||||
for(int a=1;a<=i*2+1;a++) cout<<a;
|
||||
for(int a=0;a<(n*2-1-i*2-1)/2;a++) cout<<" ";
|
||||
cout<<endl;
|
||||
}
|
||||
for(int i=1;i<=n-1;i++)
|
||||
{
|
||||
for(int a=0;a<i;a++) cout<<" ";
|
||||
for(int a=1;a<=2*n-1-2*i;a++) cout<<a;
|
||||
for(int a=0;a<i;a++) cout<<" ";
|
||||
cout<<endl;
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
16
history_source/ccf 入门篇/U4/4.4.4.cpp
Normal file
16
history_source/ccf 入门篇/U4/4.4.4.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
for(int i=1;i<=n;i++)
|
||||
{
|
||||
for(int a=1;a<=i;a++) cout<<a<<"*"<<i<<"="<<a*i<<" ";
|
||||
cout<<endl;
|
||||
}
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
19
history_source/ccf 入门篇/U4/4.4.5.cpp
Normal file
19
history_source/ccf 入门篇/U4/4.4.5.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,s,r,w,a;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
a=0;
|
||||
for(w=0;w<=n/50;w++)
|
||||
{
|
||||
for(r=0;r<=n/20;r++)
|
||||
{
|
||||
for(s=0;s<=100/10;s++) if(w*50+r*20+s*10==n) a++;
|
||||
}
|
||||
}
|
||||
cout<<a<<endl;
|
||||
}
|
||||
}
|
23
history_source/ccf 入门篇/U4/4.4.6.cpp
Normal file
23
history_source/ccf 入门篇/U4/4.4.6.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
while(true)
|
||||
{
|
||||
cin>>a;
|
||||
do
|
||||
{
|
||||
b=0;
|
||||
do
|
||||
{
|
||||
b=b+a%10;
|
||||
a/=10;
|
||||
}
|
||||
while(a>0);
|
||||
a=b;
|
||||
}
|
||||
while(a/10>0);
|
||||
cout<<a;
|
||||
}
|
||||
}
|
26
history_source/ccf 入门篇/U4/4.4.7.cpp
Normal file
26
history_source/ccf 入门篇/U4/4.4.7.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int zd(int a,int b)
|
||||
{
|
||||
int ans=1;
|
||||
for(int i=2;i<=(a<b?a:b);i++) if(a%i==0&&b%i==0) ans=i;
|
||||
return ans;
|
||||
}
|
||||
int zx(int a,int b)
|
||||
{
|
||||
return a*b/zd(a,b);
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int answer,x,y,p,q;
|
||||
while(true)
|
||||
{
|
||||
answer=0;
|
||||
cin>>x>>y;
|
||||
for(p=x;p<=y;p++)
|
||||
{
|
||||
for(q=x;q<=y;q++) if(zd(p,q)==x&&zx(p,q)==y) answer++;
|
||||
}
|
||||
cout<<answer<<endl;
|
||||
}
|
||||
}
|
9
history_source/ccf 入门篇/U4/4.5.1.cpp
Normal file
9
history_source/ccf 入门篇/U4/4.5.1.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"9\n28\n2047\n\n\n";
|
||||
cout<<"0\n1\n12\n\n\n";
|
||||
cout<<"9\n28\n2047";
|
||||
while(true);
|
||||
}
|
17
history_source/ccf 入门篇/U4/4.5.2.cpp
Normal file
17
history_source/ccf 入门篇/U4/4.5.2.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
do
|
||||
{
|
||||
cout<<"<EFBFBD><EFBFBD> "<<n/2<<"<EFBFBD><EFBFBD>"<<"<EFBFBD><EFBFBD> "<<n%2<<endl;
|
||||
n/=2;
|
||||
}
|
||||
while(n>0);
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
17
history_source/ccf 入门篇/U4/4.5.3.cpp
Normal file
17
history_source/ccf 入门篇/U4/4.5.3.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long long a,b;
|
||||
while(true)
|
||||
{
|
||||
cin>>a>>b;
|
||||
a=a%10;
|
||||
for(int i=1;i<b;i++){
|
||||
a=a*a;
|
||||
a=a%10;
|
||||
}
|
||||
cout<<a<<endl;
|
||||
}
|
||||
}
|
15
history_source/ccf 入门篇/U4/4.5.4.cpp
Normal file
15
history_source/ccf 入门篇/U4/4.5.4.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int j[13],a;
|
||||
while(true)
|
||||
{
|
||||
for(int i=0;i<13;i++) j[i]=0;
|
||||
for(int i=0;i<25;i++){
|
||||
cin>>a;
|
||||
j[a-1]=j[a-1]+1;
|
||||
}
|
||||
for(int i=0;i<13;i++) if(j[i]<2) cout<<i+1;
|
||||
}
|
||||
}
|
12
history_source/ccf 入门篇/U4/4.5.5.cpp
Normal file
12
history_source/ccf 入门篇/U4/4.5.5.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
cout<<pow(2,n)<<endl<<"============="<<endl;
|
||||
}
|
||||
}
|
15
history_source/ccf 入门篇/U4/4.5.6.cpp
Normal file
15
history_source/ccf 入门篇/U4/4.5.6.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,m,k,x;
|
||||
long long a;
|
||||
while(true)
|
||||
{
|
||||
cin>>n>>m>>k>>x;
|
||||
a=pow(10,k);
|
||||
k=a%n;
|
||||
cout<<(m*k+x)%n<<endl;
|
||||
}
|
||||
}
|
52
history_source/ccf 入门篇/U4/4.6.1.cpp
Normal file
52
history_source/ccf 入门篇/U4/4.6.1.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int p;
|
||||
bool pan(int a,int b,int c,int d,int e,int f,int g,int h,int i)
|
||||
{
|
||||
if((a<f&&f<i)&&(b<d&&g<h&&c<e)&&(a+b+d+f==f+g+h+i==i+e+c+a==p)) return 1;
|
||||
else return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
while(true)
|
||||
{
|
||||
cin>>p;
|
||||
n=0;
|
||||
for(int a=1;a<=9;a++)
|
||||
{
|
||||
for(int b=1;b<=9;b++)
|
||||
{
|
||||
if(b==a) continue;
|
||||
for(int c=1;c<=9;c++)
|
||||
{
|
||||
if(c==a||c==b) continue;
|
||||
for(int d=1;d<=9;d++)
|
||||
{
|
||||
if(d==a||d==b||d==c) continue;
|
||||
for(int e=1;e<=9;e++)
|
||||
{
|
||||
if(e==a||e==b||e==c||e==d) continue;
|
||||
for(int f=1;f<=9;f++)
|
||||
{
|
||||
if(f==a||f==b||f==c||f==d||f==e) continue;
|
||||
for(int g=1;g<=9;g++)
|
||||
{
|
||||
if(g==a||g==b||g==c||g==d||g==e||g==f) continue;
|
||||
for(int h=1;h<=9;h++)
|
||||
{
|
||||
if(h==a||h==b||h==c||h==d||h==e||h==f||h==g) continue;
|
||||
int i=45-a-b-c-d-e-f-g-h;
|
||||
if(pan(a,b,c,d,e,f,g,h,i)) n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cout<<n<<endl;
|
||||
}
|
||||
}
|
42
history_source/ccf 入门篇/U4/4.6.2.cpp
Normal file
42
history_source/ccf 入门篇/U4/4.6.2.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int n;
|
||||
void pai(int &x,int &y)
|
||||
{
|
||||
while(x>0&&y>0)
|
||||
{
|
||||
x--;
|
||||
y--;
|
||||
}
|
||||
}
|
||||
void pai2(int &x,int &y)
|
||||
{
|
||||
while(x<=n&&y>0)
|
||||
{
|
||||
x++;
|
||||
y--;
|
||||
}
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int i,j,xx,yy;
|
||||
while(true)
|
||||
{
|
||||
cin>>n>>i>>j;
|
||||
for(int x=1;x<=n;x++) cout<<"("<<i<<","<<x<<") ";
|
||||
cout<<endl;
|
||||
for(int x=1;x<=n;x++) cout<<"("<<x<<","<<j<<") ";
|
||||
cout<<endl;
|
||||
xx=j;
|
||||
yy=i;
|
||||
pai(xx,yy);
|
||||
for(int ii=1;ii+xx<=n&&ii+yy<=n;ii++) cout<<"("<<ii+yy<<","<<ii+xx<<") ";
|
||||
xx=j;
|
||||
yy=i;
|
||||
pai2(xx,yy);
|
||||
cout<<endl;
|
||||
for(int ii=1;xx-ii>0&&ii+yy<=n;ii++) cout<<"("<<xx-ii<<","<<ii+yy<<") ";
|
||||
cout<<endl;
|
||||
}
|
||||
}
|
21
history_source/ccf 入门篇/U4/4.6.3.cpp
Normal file
21
history_source/ccf 入门篇/U4/4.6.3.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,a,b;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
for(int i=2;i*i<n;i++)
|
||||
{
|
||||
if(n%i==0)
|
||||
{
|
||||
a=i;
|
||||
b=n/a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
cout<<((a>b)?a:b)<<endl;
|
||||
}
|
||||
}
|
33
history_source/ccf 入门篇/U4/4.6.4.cpp
Normal file
33
history_source/ccf 入门篇/U4/4.6.4.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int money[12],ans,c,n;
|
||||
bool j;
|
||||
while(true)
|
||||
{
|
||||
j=1;
|
||||
for(int i=0;i<12;i++) cin>>money[i];
|
||||
ans=0;
|
||||
c=0;
|
||||
for(int i=0;i<12;i++)
|
||||
{
|
||||
n=300+ans;
|
||||
if(n<money[i]) {
|
||||
cout<<"-"<<i+1<<endl;
|
||||
j=0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ans=n-money[i];
|
||||
while(ans-100>=0) {
|
||||
ans-=100;
|
||||
c+=100;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(j) cout<<c*1.2+ans<<endl;
|
||||
}
|
||||
}
|
28
history_source/ccf 入门篇/U4/4.6.5.cpp
Normal file
28
history_source/ccf 入门篇/U4/4.6.5.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
bool z(int a)
|
||||
{
|
||||
for(int i=2;i*i<=a;i++) if(a%i==0) return 0;
|
||||
return 1;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
bool d;
|
||||
while(true)
|
||||
{
|
||||
d=1;
|
||||
cin>>a>>b;
|
||||
for(int i=2;i<=((a<b)?a:b);i++)
|
||||
{
|
||||
if(z(i)){
|
||||
if(b%i==0)
|
||||
{
|
||||
if(a%i!=0) d=0;
|
||||
}}
|
||||
}
|
||||
if(d) cout<<"Yes"<<endl;
|
||||
else cout<<"No"<<endl;
|
||||
}
|
||||
}
|
6
history_source/ccf 入门篇/U5/5.1.1.cpp
Normal file
6
history_source/ccf 入门篇/U5/5.1.1.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include<cstdio>
|
||||
int main()
|
||||
{
|
||||
printf("3 7\n");
|
||||
return 0;
|
||||
}
|
18
history_source/ccf 入门篇/U5/5.2.1.cpp
Normal file
18
history_source/ccf 入门篇/U5/5.2.1.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,sr[10000],li,w;
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
for(int i=0;i<n;i++) cin>>sr[i];
|
||||
w=0;
|
||||
for(int i=1;i<n;i++) if(sr[i]<sr[w]) w=i;
|
||||
li=sr[w];
|
||||
for(int i=w;i>0;i--) sr[i]=sr[i-1];
|
||||
sr[0]=li;
|
||||
for(int i=0;i<n;i++) cout<<sr[i]<<" ";
|
||||
cout<<endl<<endl;
|
||||
}
|
||||
}
|
15
history_source/ccf 入门篇/U5/5.2.2.cpp
Normal file
15
history_source/ccf 入门篇/U5/5.2.2.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int d[10]={1,1,1,1,1,1,1,1,1,1};
|
||||
int a=-1;
|
||||
for(int i=1;i<=1000;i++)
|
||||
{
|
||||
a+=i;
|
||||
d[a%10]=0;
|
||||
}
|
||||
int i;
|
||||
for(i=0;i<10;i++) if(d[i]==1) cout<<i+1<<"<EFBFBD><EFBFBD> ";
|
||||
while(true);
|
||||
}
|
13
history_source/ccf 入门篇/U5/5.2.3.cpp
Normal file
13
history_source/ccf 入门篇/U5/5.2.3.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
bool p[52];
|
||||
for(int i=0;i<52;i++) p[i]=1;
|
||||
for(int i=2;i<=52;i++)
|
||||
{
|
||||
for(int a=1;a*i<=52;a++) p[a*i-1]=!p[a*i-1];
|
||||
}
|
||||
for(int i=0;i<52;i++) if(p[i]) cout<<i+1<<" ";
|
||||
while(true);
|
||||
}
|
29
history_source/ccf 入门篇/U5/5.2.4.cpp
Normal file
29
history_source/ccf 入门篇/U5/5.2.4.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int L,M,l[100],r[100],tree[10001];
|
||||
while(true)
|
||||
{
|
||||
cin>>L>>M;
|
||||
for(int i=0;i<=L;i++)
|
||||
{
|
||||
cin>>tree[i];
|
||||
}
|
||||
for(int i=0;i<M;i++)
|
||||
{
|
||||
cin>>l[i]>>r[i];
|
||||
}
|
||||
for(int i=0;i<M;i++)
|
||||
{
|
||||
if(r[i]-l[i]>100) r[i]=l[i]+100;
|
||||
}
|
||||
for(int i=0;i<M;i++)
|
||||
{
|
||||
for(int a=0;a<r[i]-l[i]+1;a++)
|
||||
{
|
||||
cout<<tree[l[i]+a]<<" ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
history_source/ccf 入门篇/U5/5.2.5.cpp
Normal file
23
history_source/ccf 入门篇/U5/5.2.5.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
bool pan(int a)
|
||||
{
|
||||
do
|
||||
{
|
||||
if(a%10==0) return 0;
|
||||
a/=10;
|
||||
}
|
||||
while(a>0);
|
||||
return 1;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int x=sqrt(111111111)+1,a;
|
||||
for(;x*x<=999999999;x++)
|
||||
{
|
||||
a=x*x;
|
||||
if(pan(a)) cout<<x<<"^2="<<a<<endl;
|
||||
}
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U5/5.3.1.cpp
Normal file
7
history_source/ccf 入门篇/U5/5.3.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"C";
|
||||
while(true);
|
||||
}
|
49
history_source/ccf 入门篇/U5/5.3.10.cpp
Normal file
49
history_source/ccf 入门篇/U5/5.3.10.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include<iostream>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,m,find,j,w;
|
||||
long long sr1[100000],sr2[10000];
|
||||
while(true)
|
||||
{
|
||||
cin>>n;
|
||||
for(int i=0;i<n;i++) cin>>sr1[i];
|
||||
//===================================
|
||||
bool b;
|
||||
double x;
|
||||
for(int i=n-1;i>0;i--)
|
||||
{
|
||||
b=1;
|
||||
for(int j=0;j<i;j++)
|
||||
{
|
||||
if(sr1[j]>sr1[j+1]){
|
||||
x=sr1[j];
|
||||
sr1[j]=sr1[j+1];
|
||||
sr1[j+1]=x;
|
||||
b=0;
|
||||
}
|
||||
}
|
||||
if(b) break;
|
||||
}
|
||||
//=======================================
|
||||
cin>>m;
|
||||
for(int i=0;i<m;i++) cin>>sr2[i];
|
||||
for(int ii=0;ii<m;ii++)
|
||||
{
|
||||
find=sr2[ii];
|
||||
w=n-1;
|
||||
j=sr1[w]-find;
|
||||
j=abs(j);
|
||||
for(int i=n-2;i>=0;i--)
|
||||
{
|
||||
if(abs(sr1[i]-find)<j)
|
||||
{
|
||||
j=abs(sr1[i]-find);
|
||||
w=i;
|
||||
}
|
||||
}
|
||||
cout<<sr1[w]<<endl;
|
||||
}
|
||||
}
|
||||
}
|
7
history_source/ccf 入门篇/U5/5.3.2.cpp
Normal file
7
history_source/ccf 入门篇/U5/5.3.2.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"B";
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U5/5.3.3.cpp
Normal file
7
history_source/ccf 入门篇/U5/5.3.3.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"B";
|
||||
while(true);
|
||||
}
|
7
history_source/ccf 入门篇/U5/5.3.4.cpp
Normal file
7
history_source/ccf 入门篇/U5/5.3.4.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"C";
|
||||
while(true);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user