delete pics to save space
This commit is contained in:
7
history_source/信息学奥赛一本通/1.1.1.cpp
Normal file
7
history_source/信息学奥赛一本通/1.1.1.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"Hello, World!"<<endl;
|
||||
return 0;
|
||||
}
|
9
history_source/信息学奥赛一本通/1.1.2.cpp
Normal file
9
history_source/信息学奥赛一本通/1.1.2.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
cin>>b>>a>>b;
|
||||
cout<<a<<endl;
|
||||
return 0;
|
||||
}
|
24
history_source/信息学奥赛一本通/1.1.3.cpp
Normal file
24
history_source/信息学奥赛一本通/1.1.3.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
void print(int n)
|
||||
{
|
||||
if(n<10) cout<<" ";
|
||||
else if(n<100) cout<<" ";
|
||||
else if(n<1000) cout<<" ";
|
||||
else if(n<10000) cout<<" ";
|
||||
else if(n<100000) cout<<" ";
|
||||
else if(n<1000000) cout<<" ";
|
||||
else if(n<10000000) cout<<" ";
|
||||
cout<<n;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int a,b,c;
|
||||
cin>>a>>b>>c;
|
||||
print(a);
|
||||
cout<<" ";
|
||||
print(b);
|
||||
cout<<" ";
|
||||
print(c);
|
||||
return 0;
|
||||
}
|
13
history_source/信息学奥赛一本通/1.1.4.cpp
Normal file
13
history_source/信息学奥赛一本通/1.1.4.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include<iostream>
|
||||
#include<conio.h>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
char a;
|
||||
a=getch();
|
||||
cout<<a<<endl;
|
||||
cout<<" "<<a<<endl;
|
||||
cout<<" "<<a<<a<<a<<endl;
|
||||
cout<<a<<a<<a<<a<<a<<endl;
|
||||
return 0;
|
||||
}
|
10
history_source/信息学奥赛一本通/1.1.5.cpp
Normal file
10
history_source/信息学奥赛一本通/1.1.5.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int x,a,y,b;
|
||||
cin>>x>>a>>y>>b;
|
||||
int d=(b*y-x*a)/(b-a);
|
||||
cout<<d<<endl;
|
||||
return 0;
|
||||
}
|
9
history_source/信息学奥赛一本通/1.2.2.1.cpp
Normal file
9
history_source/信息学奥赛一本通/1.2.2.1.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
cin>>a>>b;
|
||||
cout<<a+b<<endl;
|
||||
return 0;
|
||||
}
|
10
history_source/信息学奥赛一本通/1.2.2.2.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.2.2.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b,c;
|
||||
cin>>a>>b>>c;
|
||||
cout<<(a+b)*c<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
10
history_source/信息学奥赛一本通/1.2.2.3.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.2.3.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b,c;
|
||||
cin>>a>>b>>c;
|
||||
cout<<(a+b)/c<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
10
history_source/信息学奥赛一本通/1.2.2.4.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.2.4.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
cin>>a>>b;
|
||||
cout<<a/b<<" "<<a%b<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
10
history_source/信息学奥赛一本通/1.2.2.5.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.2.5.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double a,b;
|
||||
scanf("%lf%lf",&a,&b);
|
||||
printf("%.9lf\n",a/b);
|
||||
return 0;
|
||||
}
|
||||
|
10
history_source/信息学奥赛一本通/1.2.3.2.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.3.2.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double a,b,c,d,x;
|
||||
scanf("%lf%lf%lf%lf%lf",&a,&b,&c,&d,&x);
|
||||
double ans=a*x*x*x+b*x*x+c*x+d;
|
||||
printf("%.7lf\n",ans);
|
||||
return 0;
|
||||
}
|
11
history_source/信息学奥赛一本通/1.2.3.3.cpp
Normal file
11
history_source/信息学奥赛一本通/1.2.3.3.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double f,c;
|
||||
scanf("%lf",&f);
|
||||
c=5.0*(f-32.0)/9.0;
|
||||
printf("%.5lf\n",c);
|
||||
return 0;
|
||||
}
|
||||
|
14
history_source/信息学奥赛一本通/1.2.3.4.cpp
Normal file
14
history_source/信息学奥赛一本通/1.2.3.4.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include<cstdio>
|
||||
#define pi 3.1415926535897
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double r,c,d,s;
|
||||
scanf("%lf",&r);
|
||||
c=r*pi;
|
||||
d=r*2;
|
||||
s=r*r*pi;
|
||||
printf("%.4lf %.4lf %.4lf\n",d,c,s);
|
||||
return 0;
|
||||
}
|
||||
|
10
history_source/信息学奥赛一本通/1.2.3.5.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.3.5.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double r1,r2;
|
||||
scanf("%lf%lf",&r1,&r2);
|
||||
double ans=1.0/(1.0/r1+1.0/r2);
|
||||
printf("%.2lf\n",ans);
|
||||
return 0;
|
||||
}
|
10
history_source/信息学奥赛一本通/1.2.5.1.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.5.1.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double a;
|
||||
scanf("%lf",&a);
|
||||
printf("%.3lf\n",a);
|
||||
return 0;
|
||||
}
|
||||
|
10
history_source/信息学奥赛一本通/1.2.5.2.cpp
Normal file
10
history_source/信息学奥赛一本通/1.2.5.2.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double a;
|
||||
scanf("%lf",&a);
|
||||
printf("%.12lf\n",a);
|
||||
return 0;
|
||||
}
|
||||
|
12
history_source/信息学奥赛一本通/1.2.5.3.cpp
Normal file
12
history_source/信息学奥赛一本通/1.2.5.3.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
char a;
|
||||
int b;
|
||||
double c,d;
|
||||
scanf("%c%d%lf%lf",&a,&b,&c,&d);
|
||||
printf("%c %d %.6lf %.6lf\n",a,b,c,d);
|
||||
return 0;
|
||||
}
|
||||
|
11
history_source/信息学奥赛一本通/1.2.5.4.cpp
Normal file
11
history_source/信息学奥赛一本通/1.2.5.4.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double a;
|
||||
scanf("%lf",&a);
|
||||
printf("%.5lf\n",a);
|
||||
printf("%e\n",a);
|
||||
printf("%g\n",a);
|
||||
return 0;
|
||||
}
|
14
history_source/信息学奥赛一本通/1.2.5.5.cpp
Normal file
14
history_source/信息学奥赛一本通/1.2.5.5.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
char a;
|
||||
scanf("%c",&a);
|
||||
cout<<" "<<a<<endl;
|
||||
cout<<" "<<a<<a<<a<<endl;
|
||||
cout<<a<<a<<a<<a<<a<<endl;
|
||||
cout<<" "<<a<<a<<a<<endl;
|
||||
cout<<" "<<a<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
15
history_source/信息学奥赛一本通/1.2.6.1.cpp
Normal file
15
history_source/信息学奥赛一本通/1.2.6.1.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
double fmod(double a,double b)
|
||||
{
|
||||
long long x=a/b;
|
||||
return a-b*x;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
double a,b;
|
||||
scanf("%lf%lf",&a,&b);
|
||||
printf("%lf\n",fmod(a,b));
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.2.6.10.cpp
Normal file
17
history_source/信息学奥赛一本通/1.2.6.10.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double a,b,c;
|
||||
scanf("%lf%lf%lf",&a,&b,&c);
|
||||
if(!(a+b>c&&a+c>b&&b+c>a)) printf("no\n");
|
||||
else
|
||||
{
|
||||
double p=(a+b+c)/2.0;
|
||||
double ans=sqrt(p*(p-a)*(p-b)*(p-c));
|
||||
printf("%lf\n",ans);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
11
history_source/信息学奥赛一本通/1.2.6.2.cpp
Normal file
11
history_source/信息学奥赛一本通/1.2.6.2.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<cstdio>
|
||||
#define pi 3.14
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double r;
|
||||
scanf("%lf",&r);
|
||||
printf("%.2lf\n",4.0/3.0*pi*r*r*r);
|
||||
return 0;
|
||||
}
|
||||
|
14
history_source/信息学奥赛一本通/1.2.6.3.cpp
Normal file
14
history_source/信息学奥赛一本通/1.2.6.3.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int num(char a,char b,char c)
|
||||
{
|
||||
return (a-'0')*100+(b-'0')*10+c-'0';
|
||||
}
|
||||
int main()
|
||||
{
|
||||
char a,b,c;
|
||||
scanf("%c%c%c",&a,&b,&c);
|
||||
printf("%d\n",num(c,b,a));
|
||||
return 0;
|
||||
}
|
||||
|
14
history_source/信息学奥赛一本通/1.2.6.4.cpp
Normal file
14
history_source/信息学奥赛一本通/1.2.6.4.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
#define pi 3.1415926535897
|
||||
int main()
|
||||
{
|
||||
double v,r,h;
|
||||
scanf("%lf%lf",&h,&r);
|
||||
v=h*pi*r*r;
|
||||
int ans=0;
|
||||
double k=20;
|
||||
while(k>0) k-=v,ans++;
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
16
history_source/信息学奥赛一本通/1.2.6.5.cpp
Normal file
16
history_source/信息学奥赛一本通/1.2.6.5.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
struct Point
|
||||
{
|
||||
double x,y;
|
||||
};
|
||||
int main()
|
||||
{
|
||||
Point p1,p2;
|
||||
scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
|
||||
double a=abs(p1.x-p2.x),b=abs(p1.y-p2.y),c=sqrt(a*a+b*b);
|
||||
printf("%.3lf\n",c);
|
||||
return 0;
|
||||
}
|
||||
|
25
history_source/信息学奥赛一本通/1.2.6.6.cpp
Normal file
25
history_source/信息学奥赛一本通/1.2.6.6.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
struct Point
|
||||
{
|
||||
double x,y;
|
||||
};
|
||||
double lenth(Point A,Point B)
|
||||
{
|
||||
double a=abs(A.x-B.x),b=abs(A.y-B.y),c=sqrt(a*a+b*b);
|
||||
return c;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
Point A,B,C;
|
||||
scanf("%lf%lf%lf%lf%lf%lf",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y);
|
||||
double a,b,c;
|
||||
a=lenth(A,B);
|
||||
b=lenth(B,C);
|
||||
c=lenth(C,A);
|
||||
double p=(a+b+c)/2.0;
|
||||
double ans=sqrt(p*(p-a)*(p-b)*(p-c));
|
||||
printf("%.2lf\n",ans);
|
||||
return 0;
|
||||
}
|
11
history_source/信息学奥赛一本通/1.2.6.7.cpp
Normal file
11
history_source/信息学奥赛一本通/1.2.6.7.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long long a,b,c;
|
||||
scanf("%ld%ld",&a,&b);
|
||||
c=a*b;
|
||||
printf("%ld\n",c);
|
||||
return 0;
|
||||
}
|
||||
|
103
history_source/信息学奥赛一本通/1.2.6.8.cpp
Normal file
103
history_source/信息学奥赛一本通/1.2.6.8.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
#include<vector>
|
||||
#include<cmath>
|
||||
#include<string>
|
||||
struct bigNum
|
||||
{
|
||||
vector<unsigned int> num;
|
||||
static const unsigned int BASE=100000000,W=8;//<2F><>λ<EFBFBD><CEBB>(100000000<30><30><EFBFBD><EFBFBD>)
|
||||
void clear(int size)
|
||||
{
|
||||
if(num.size()==0) num.push_back(0);
|
||||
while(num[0]==0&&num.size()-size>0) num.erase(num.begin());
|
||||
}
|
||||
bigNum operator=(string sr)//<2F><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
{
|
||||
num.clear();
|
||||
for(int i=0;i<sr.size();i++)
|
||||
{
|
||||
if(i%W==0) num.insert(num.begin(),0);
|
||||
num[0]=num[0]+(sr[sr.size()-1-i]-'0')*pow(10,i%W);
|
||||
}
|
||||
bigNum a;
|
||||
a.num=num;
|
||||
a.clear(0);
|
||||
return a;
|
||||
}
|
||||
bigNum operator+(bigNum b)
|
||||
{
|
||||
bigNum ans;
|
||||
ans.num=num;
|
||||
if(ans.num.size()<b.num.size())//ȷ<><C8B7>ans<6E><73>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD>b<EFBFBD><62>λ<EFBFBD><CEBB>
|
||||
{
|
||||
bigNum li;
|
||||
li=ans;
|
||||
ans=b;
|
||||
b=li;
|
||||
}
|
||||
unsigned long long j=0;
|
||||
for(int ai=ans.num.size()-1,bi=b.num.size()-1;bi>=0;ai--,bi--)
|
||||
{
|
||||
j=ans.num[ai]+b.num[bi]+j;
|
||||
ans.num[ai]=j%BASE;//<2F><>λ
|
||||
j/=BASE;
|
||||
}
|
||||
if(j>0)
|
||||
{
|
||||
for(int ai=ans.num.size()-b.num.size()-1;ai>=0;ai--)
|
||||
{
|
||||
j=ans.num[ai]+j;
|
||||
ans.num[ai]=j%BASE;
|
||||
j/=BASE;
|
||||
}
|
||||
}//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
||||
if(j>0) ans.num.insert(ans.num.begin(),1);//<2F><>λ
|
||||
return ans;
|
||||
}
|
||||
};
|
||||
istream& operator>>(istream &in,bigNum& x)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
string s;
|
||||
char li;
|
||||
in.get(li);
|
||||
while(li>='0'&&li<='9')//<2F><>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>ȡ<EFBFBD>Ƿ<EFBFBD><C7B7>ַ<EFBFBD>
|
||||
{
|
||||
s+=li;
|
||||
in.get(li);
|
||||
}
|
||||
x=s;//<2F><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
return in;
|
||||
}
|
||||
ostream& operator<<(ostream &out,const bigNum &x)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
{
|
||||
out<<x.num[0];
|
||||
for(int i=1;i<x.num.size();i++)//ȷ<><C8B7><EFBFBD><EFBFBD>8λ
|
||||
{
|
||||
if(x.num[i]<10) out<<"0000000";
|
||||
else if(x.num[i]<100) out<<"000000";
|
||||
else if(x.num[i]<1000) out<<"00000";
|
||||
else if(x.num[i]<10000) out<<"0000";
|
||||
else if(x.num[i]<100000) out<<"000";
|
||||
else if(x.num[i]<1000000) out<<"00";
|
||||
else if(x.num[i]<10000000) out<<"0";
|
||||
out<<x.num[i];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
bigNum str_big(string sr)
|
||||
{
|
||||
bigNum ans;
|
||||
ans=sr;
|
||||
return ans;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
bigNum ans;
|
||||
ans="1";
|
||||
for(int i=0;i<n;i++) ans=ans+ans;
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
12
history_source/信息学奥赛一本通/1.2.6.9.cpp
Normal file
12
history_source/信息学奥赛一本通/1.2.6.9.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,x,y;
|
||||
scanf("%d%d%d",&n,&x,&y);
|
||||
n-=y/x;
|
||||
if(y%x!=0) n--;
|
||||
if(n<0) n=0;
|
||||
printf("%d\n",n);
|
||||
return 0;
|
||||
}
|
11
history_source/信息学奥赛一本通/1.3.1.cpp
Normal file
11
history_source/信息学奥赛一本通/1.3.1.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
if(n&1&&n!=7) printf("NO\n");
|
||||
else printf("YES\n");
|
||||
return 0;
|
||||
}
|
||||
|
13
history_source/信息学奥赛一本通/1.3.10.cpp
Normal file
13
history_source/信息学奥赛一本通/1.3.10.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double x1,x2,a,b,c;
|
||||
scanf("%lf%lf%lf",&a,&b,&c);
|
||||
x1=(-b+sqrt(b*b-4*a*c))/(2*a);
|
||||
x2=(-b-sqrt(b*b-4*a*c))/(2*a);
|
||||
printf("%.5lf\n%.5lf\n",x1,x2);
|
||||
return 0;
|
||||
}
|
||||
|
12
history_source/信息学奥赛一本通/1.3.2.cpp
Normal file
12
history_source/信息学奥赛一本通/1.3.2.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double s;
|
||||
scanf("%lf",&s);
|
||||
if(s==100) printf("All\n");
|
||||
if(s>100) printf("Bike\n");
|
||||
if(s<100) printf("Walk\n");
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.3.3.cpp
Normal file
16
history_source/信息学奥赛一本通/1.3.3.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
double f(double x)
|
||||
{
|
||||
if(x>=0&&x<5) return -x+2.5;
|
||||
if(x>=5&&x<10) return 2-1.5*(x-3)*(x-3);
|
||||
if(x>=10&&x<20) return x/2.0-1.5;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
double n;
|
||||
scanf("%lf",&n);
|
||||
printf("%lf\n",f(n));
|
||||
return 0;
|
||||
}
|
||||
|
15
history_source/信息学奥赛一本通/1.3.4.cpp
Normal file
15
history_source/信息学奥赛一本通/1.3.4.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int g;
|
||||
bool s;
|
||||
scanf("%d%d",&g,&s);
|
||||
int ans=8;
|
||||
g-=1000;
|
||||
if(g>0) ans+=(g/500)*4;
|
||||
if(g%500!=0) ans+=4;
|
||||
if(s) ans+=5;
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
12
history_source/信息学奥赛一本通/1.3.5.cpp
Normal file
12
history_source/信息学奥赛一本通/1.3.5.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a[3];
|
||||
for(int i=0;i<3;i++) scanf("%d",a+i);
|
||||
int ans=a[0];
|
||||
for(int i=1;i<3;i++) if(a[i]>ans) ans=a[i];
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
11
history_source/信息学奥赛一本通/1.3.6.cpp
Normal file
11
history_source/信息学奥赛一本通/1.3.6.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b,c;
|
||||
scanf("%d%d%d",&a,&b,&c);
|
||||
if(a+b>c&&a+c>b&&b+c>a) printf("yes\n");
|
||||
else printf("no\n");
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.3.7.cpp
Normal file
17
history_source/信息学奥赛一本通/1.3.7.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
bool isr(int n)
|
||||
{
|
||||
if(n%400==0) return 1;
|
||||
if(n%100==0) return 0;
|
||||
if(n%4==0) return 1;
|
||||
return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
printf("%c\n",isr(n)?'Y':'N');
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.3.8.cpp
Normal file
16
history_source/信息学奥赛一本通/1.3.8.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int abs(int n)
|
||||
{
|
||||
if(n<0) n=-n;
|
||||
return n;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int x,y;
|
||||
scanf("%d%d",&x,&y);
|
||||
if(abs(x)<=1&&abs(y)<=1) printf("yes\n");
|
||||
else printf("no\n");
|
||||
return 0;
|
||||
}
|
||||
|
21
history_source/信息学奥赛一本通/1.3.9.cpp
Normal file
21
history_source/信息学奥赛一本通/1.3.9.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
char f;
|
||||
scanf("%d%c%d",&a,&f,&b);
|
||||
switch(f)
|
||||
{
|
||||
case '+':printf("%d\n",a+b);break;
|
||||
case '-':printf("%d\n",a-b);break;
|
||||
case '*':printf("%d\n",a*b);break;
|
||||
case '/':
|
||||
if(b==0) printf("Divided by zero!\n");
|
||||
else printf("%d\n",a/b);
|
||||
break;
|
||||
default:printf("Invalid operator!\n");j
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.1.1.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.1.1.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
double add,x;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%lf",&x);
|
||||
add+=x;
|
||||
}
|
||||
add=add/n;
|
||||
printf("%lf",add);
|
||||
return 0;
|
||||
}
|
15
history_source/信息学奥赛一本通/1.4.1.10.cpp
Normal file
15
history_source/信息学奥赛一本通/1.4.1.10.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int ans=0,n,k,x;
|
||||
scanf("%d%d",&n,&k);
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if(x==k) ans++;
|
||||
}
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
11
history_source/信息学奥赛一本通/1.4.1.11.cpp
Normal file
11
history_source/信息学奥赛一本通/1.4.1.11.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int ans=1,a,n;
|
||||
scanf("%d%d",&a,&n);
|
||||
for(int i=0;i<n;i++) ans*=a;
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
12
history_source/信息学奥赛一本通/1.4.1.12.cpp
Normal file
12
history_source/信息学奥赛一本通/1.4.1.12.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double x;
|
||||
int n;
|
||||
scanf("%lf%d",&x,&n);
|
||||
for(int i=0;i<n;i++) x*=1.001;
|
||||
printf("%.4lf\n",x);
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.4.1.13.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.1.13.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long long a,b,c;
|
||||
a=b=c=1;
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
for(int i=3;i<=n;i++)
|
||||
{
|
||||
c=a+b;
|
||||
a=b;
|
||||
b=c;
|
||||
}
|
||||
printf("%ld\n",c);
|
||||
return 0;
|
||||
}
|
27
history_source/信息学奥赛一本通/1.4.1.14.cpp
Normal file
27
history_source/信息学奥赛一本通/1.4.1.14.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
struct L
|
||||
{
|
||||
double a,b,x;
|
||||
};
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
L J;
|
||||
L G[n-1];
|
||||
scanf("%lf%lf",&J.a,&J.b);
|
||||
J.x=J.b/J.a;
|
||||
for(int i=0;i<n-1;i++)
|
||||
{
|
||||
scanf("%lf%lf",&G[i].a,&G[i].b);
|
||||
G[i].x=G[i].b/G[i].a;
|
||||
}
|
||||
for(int i=0;i<n-1;i++)
|
||||
{
|
||||
if(G[i].x-J.x>0.05) printf("better\n");
|
||||
else if(J.x-G[i].x>0.05) printf("worse\n");
|
||||
else printf("same\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
28
history_source/信息学奥赛一本通/1.4.1.15.cpp
Normal file
28
history_source/信息学奥赛一本通/1.4.1.15.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
struct Point
|
||||
{
|
||||
double x,y,r;
|
||||
};
|
||||
double line(Point a)
|
||||
{
|
||||
a.x=abs(a.x);
|
||||
a.y=abs(a.y);
|
||||
double s=sqrt(a.x*a.x+a.y*a.y);
|
||||
double ans=s/50.0*2;
|
||||
ans+=a.r*1.5;
|
||||
return ans;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
double ans=0;
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
Point wu[n];
|
||||
for(int i=0;i<n;i++) scanf("%lf%lf%lf",&wu[i].x,&wu[i].y,&wu[i].r);
|
||||
for(int i=0;i<n;i++) ans+=line(wu[i]);
|
||||
ans=ceil(ans);
|
||||
printf("%.0lf\n",ans);
|
||||
return 0;
|
||||
}
|
23
history_source/信息学奥赛一本通/1.4.1.16.cpp
Normal file
23
history_source/信息学奥赛一本通/1.4.1.16.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int y[12];
|
||||
for(int i=0;i<12;i++) scanf("%d",y+i);
|
||||
int add=0,c=0;
|
||||
for(int i=0;i<12;i++)
|
||||
{
|
||||
add+=300;
|
||||
add-=y[i];
|
||||
if(add<0)
|
||||
{
|
||||
printf("-%d\n",i+1);
|
||||
return 0;
|
||||
}
|
||||
c+=add/100;
|
||||
add=add%100;
|
||||
}
|
||||
printf("%d\n",c*120+add);
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.4.1.17.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.1.17.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int m,n,ans=0;
|
||||
scanf("%d%d",&m,&n);
|
||||
int x;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if(x>m) ans++;
|
||||
else m-=x;
|
||||
}
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
27
history_source/信息学奥赛一本通/1.4.1.18.cpp
Normal file
27
history_source/信息学奥赛一本通/1.4.1.18.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,a,b;
|
||||
scanf("%d",&n);
|
||||
bool ans[n];
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%d%d",&a,&b);
|
||||
ans[i]=(a>=90&&a<=140&&b>=60&&b<=90);
|
||||
}
|
||||
int answer,max;
|
||||
answer=max=0;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
if(ans[i]) max++;
|
||||
else
|
||||
{
|
||||
if(max>answer) answer=max;
|
||||
max=0;
|
||||
}
|
||||
}
|
||||
if(max>answer) answer=max;
|
||||
printf("%d\n",answer);
|
||||
return 0;
|
||||
}
|
16
history_source/信息学奥赛一本通/1.4.1.19.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.1.19.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,ans=0;
|
||||
scanf("%d",&n);
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
int x;
|
||||
scanf("%d",&x);
|
||||
if(x%10-(x/10)%10-(x/100)%10-x/1000>0) ans++;
|
||||
}
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.4.1.2.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.1.2.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
double add,x;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%lf",&x);
|
||||
add+=x;
|
||||
}
|
||||
add=add/n;
|
||||
printf("%lf",add);
|
||||
return 0;
|
||||
}
|
||||
|
19
history_source/信息学奥赛一本通/1.4.1.20.cpp
Normal file
19
history_source/信息学奥赛一本通/1.4.1.20.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
double a,b,c,ans=0;
|
||||
a=b=c=1;
|
||||
scanf("%d",&n);
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
c=a+b;
|
||||
ans+=c/b;
|
||||
a=b;
|
||||
b=c;
|
||||
}
|
||||
printf("%.4lf\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.1.21.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.1.21.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
double ans=0;
|
||||
scanf("%d",&n);
|
||||
for(int i=1;i<=n;i++)
|
||||
{
|
||||
if(i&1) ans+=1.0/i;
|
||||
else ans-=1.0/i;
|
||||
}
|
||||
printf("%.4lf\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
24
history_source/信息学奥赛一本通/1.4.1.22.cpp
Normal file
24
history_source/信息学奥赛一本通/1.4.1.22.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b,c;
|
||||
scanf("%d%d%d",&a,&b,&c);
|
||||
int li;
|
||||
if(a>b) li=a,a=b,b=li;
|
||||
if(b>c) li=b,b=c,c=li;
|
||||
if(a>b) li=a,a=b,b=li;
|
||||
li=a;
|
||||
a=b-a;
|
||||
b=c-b;
|
||||
for(int i=2;i<=li;i++)
|
||||
{
|
||||
if(a%i==0&&b%i==0)
|
||||
{
|
||||
printf("%d\n",i);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
10
history_source/信息学奥赛一本通/1.4.1.23.cpp
Normal file
10
history_source/信息学奥赛一本通/1.4.1.23.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
printf("%d\n",n*(n+1)/2);
|
||||
return 0;
|
||||
}
|
||||
|
25
history_source/信息学奥赛一本通/1.4.1.24.cpp
Normal file
25
history_source/信息学奥赛一本通/1.4.1.24.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int find_(int a,int b,int n)
|
||||
{
|
||||
a*=pow(10,n);
|
||||
return a/b;
|
||||
}
|
||||
int sun[110];
|
||||
bool find(int *front,int *last,int n)
|
||||
{
|
||||
int *p;
|
||||
for(p=front;p<last;p++)
|
||||
if(*p==n) return 1;
|
||||
return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int a,b,n;
|
||||
scanf("%d%d%d",&a,&b,&n);
|
||||
int x=0,i=1;
|
||||
while(!find(sun,sun+x,find_(a,b,i))) x++,i++;
|
||||
printf("%d\n",x);
|
||||
return 0;
|
||||
}
|
17
history_source/信息学奥赛一本通/1.4.1.25.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.1.25.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
string days[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
|
||||
int a,b;
|
||||
cin>>a>>b;
|
||||
int x=a;
|
||||
for(int i=1;i<b;i++)
|
||||
{
|
||||
a=a*x;
|
||||
a=a%7;
|
||||
}
|
||||
cout<<days[a]<<endl;
|
||||
return 0;
|
||||
}
|
17
history_source/信息学奥赛一本通/1.4.1.26.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.1.26.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int a,b;
|
||||
scanf("%d%d",&a,&b);
|
||||
a=a%1000;
|
||||
int x=a;
|
||||
for(int i=1;i<b;i++)
|
||||
{
|
||||
a*=x;
|
||||
a=a%1000;
|
||||
}
|
||||
printf("%03d\n",a);
|
||||
return 0;
|
||||
}
|
||||
|
18
history_source/信息学奥赛一本通/1.4.1.3.cpp
Normal file
18
history_source/信息学奥赛一本通/1.4.1.3.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
double add,x;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%lf",&x);
|
||||
add+=x;
|
||||
}
|
||||
printf("%.0lf\n",add);
|
||||
add=add/n;
|
||||
cout<<add<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.4.1.4.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.1.4.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
int max,x;
|
||||
scanf("%d",&max);
|
||||
for(int i=1;i<n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if(x>max) max=x;
|
||||
}
|
||||
printf("%d\n",max);
|
||||
return 0;
|
||||
}
|
||||
|
18
history_source/信息学奥赛一本通/1.4.1.5.cpp
Normal file
18
history_source/信息学奥赛一本通/1.4.1.5.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
int max,x,min;
|
||||
scanf("%d",&max);
|
||||
min=max;
|
||||
for(int i=1;i<n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if(x>max) max=x;
|
||||
if(x<min) min=x;
|
||||
}
|
||||
printf("%d\n",max-min);
|
||||
return 0;
|
||||
}
|
19
history_source/信息学奥赛一本通/1.4.1.6.cpp
Normal file
19
history_source/信息学奥赛一本通/1.4.1.6.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,j=0,y=0,t=0,x;
|
||||
scanf("%d",&n);
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
j+=x;
|
||||
scanf("%d",&x);
|
||||
y+=x;
|
||||
scanf("%d",&x);
|
||||
t+=x;
|
||||
}
|
||||
printf("%d %d %d %d\n",j,y,t,j+y+t);
|
||||
return 0;
|
||||
}
|
||||
|
12
history_source/信息学奥赛一本通/1.4.1.7.cpp
Normal file
12
history_source/信息学奥赛一本通/1.4.1.7.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,m;
|
||||
scanf("%d%d",&n,&m);
|
||||
int ans=0;
|
||||
for(int i=n;i<=m;i++) if(i&1) ans+=i;
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
12
history_source/信息学奥赛一本通/1.4.1.8.cpp
Normal file
12
history_source/信息学奥赛一本通/1.4.1.8.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,m;
|
||||
scanf("%d%d",&n,&m);
|
||||
int ans=0;
|
||||
for(int i=n;i<=m;i++) if(i%17==0) ans+=i;
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.4.1.9.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.1.9.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int k,one=0,five=0,ten=0,x;
|
||||
scanf("%d",&k);
|
||||
for(int i=0;i<k;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if(x==1) one++;
|
||||
if(x==5) five++;
|
||||
if(x==10) ten++;
|
||||
}
|
||||
printf("%d\n%d\n%d\n",one,five,ten);
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.2.1.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.2.1.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double h,add=0,high;
|
||||
scanf("%lf",&h);
|
||||
for(int i=0;i<10;i++)
|
||||
{
|
||||
add+=h;
|
||||
h/=2;
|
||||
add+=h;
|
||||
}
|
||||
add-=h;
|
||||
printf("%g\n%g\n",add,h);
|
||||
return 0;
|
||||
}
|
22
history_source/信息学奥赛一本通/1.4.2.2.cpp
Normal file
22
history_source/信息学奥赛一本通/1.4.2.2.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long long n;
|
||||
scanf("%lld",&n);
|
||||
while(n>1)
|
||||
{
|
||||
if(n&1)
|
||||
{
|
||||
printf("%lld*3+1=%lld\n",n,n*3+1);
|
||||
n=n*3+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%lld/2=%lld\n",n,n/2);
|
||||
n=n/2;
|
||||
}
|
||||
}
|
||||
printf("End\n");
|
||||
return 0;
|
||||
}
|
12
history_source/信息学奥赛一本通/1.4.2.3.cpp
Normal file
12
history_source/信息学奥赛一本通/1.4.2.3.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double add=0;
|
||||
int ans=1,n;
|
||||
scanf("%d",&n);
|
||||
while(add<=n) add+=1.0/ans,ans++;
|
||||
printf("%d\n",ans-1);
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.2.4.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.2.4.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
do
|
||||
{
|
||||
printf("%d ",n%10);
|
||||
n/=10;
|
||||
}
|
||||
while(n);
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.2.5.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.2.5.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long long a,b=0;
|
||||
scanf("%lld",&a);
|
||||
do
|
||||
{
|
||||
b=b*10+a%10;
|
||||
a/=10;
|
||||
}
|
||||
while(a);
|
||||
printf("%lld\n",b);
|
||||
return 0;
|
||||
}
|
||||
|
22
history_source/信息学奥赛一本通/1.4.2.6.cpp
Normal file
22
history_source/信息学奥赛一本通/1.4.2.6.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,k;
|
||||
scanf("%d%d",&n,&k);
|
||||
if(n%19!=0) printf("NO\n");
|
||||
else
|
||||
{
|
||||
int add=0;
|
||||
do
|
||||
{
|
||||
if(n%10==3) add++;
|
||||
n/=10;
|
||||
}
|
||||
while(n);
|
||||
if(add==k) printf("YES\n");
|
||||
else printf("NO\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.3.1.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.3.1.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double h,add=0,high;
|
||||
scanf("%lf",&h);
|
||||
for(int i=0;i<10;i++)
|
||||
{
|
||||
add+=h;
|
||||
h/=2;
|
||||
add+=h;
|
||||
}
|
||||
add-=h;
|
||||
printf("%g\n%g\n",add,h);
|
||||
return 0;
|
||||
}
|
22
history_source/信息学奥赛一本通/1.4.3.2.cpp
Normal file
22
history_source/信息学奥赛一本通/1.4.3.2.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long long n;
|
||||
scanf("%lld",&n);
|
||||
while(n>1)
|
||||
{
|
||||
if(n&1)
|
||||
{
|
||||
printf("%lld*3+1=%lld\n",n,n*3+1);
|
||||
n=n*3+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%lld/2=%lld\n",n,n/2);
|
||||
n=n/2;
|
||||
}
|
||||
}
|
||||
printf("End\n");
|
||||
return 0;
|
||||
}
|
12
history_source/信息学奥赛一本通/1.4.3.3.cpp
Normal file
12
history_source/信息学奥赛一本通/1.4.3.3.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double add=0;
|
||||
int ans=1,n;
|
||||
scanf("%d",&n);
|
||||
while(add<=n) add+=1.0/ans,ans++;
|
||||
printf("%d\n",ans-1);
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.3.4.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.3.4.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
do
|
||||
{
|
||||
printf("%d ",n%10);
|
||||
n/=10;
|
||||
}
|
||||
while(n);
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.3.5.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.3.5.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
long long a,b=0;
|
||||
scanf("%lld",&a);
|
||||
do
|
||||
{
|
||||
b=b*10+a%10;
|
||||
a/=10;
|
||||
}
|
||||
while(a);
|
||||
printf("%lld\n",b);
|
||||
return 0;
|
||||
}
|
||||
|
22
history_source/信息学奥赛一本通/1.4.3.6.cpp
Normal file
22
history_source/信息学奥赛一本通/1.4.3.6.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,k;
|
||||
scanf("%d%d",&n,&k);
|
||||
if(n%19!=0) printf("NO\n");
|
||||
else
|
||||
{
|
||||
int add=0;
|
||||
do
|
||||
{
|
||||
if(n%10==3) add++;
|
||||
n/=10;
|
||||
}
|
||||
while(n);
|
||||
if(add==k) printf("YES\n");
|
||||
else printf("NO\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.4.4.1.cpp
Normal file
16
history_source/信息学奥赛一本通/1.4.4.1.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
long long ans=0,times=1;
|
||||
scanf("%d",&n);
|
||||
for(int i=1;i<=n;i++)
|
||||
{
|
||||
times*=i;
|
||||
ans+=times;
|
||||
}
|
||||
printf("%lld\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
18
history_source/信息学奥赛一本通/1.4.4.10.cpp
Normal file
18
history_source/信息学奥赛一本通/1.4.4.10.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
long long ans=0;
|
||||
int i;
|
||||
for(i=1;n-i>=0;i++)
|
||||
{
|
||||
ans+=i*i;
|
||||
n-=i;
|
||||
}
|
||||
if(n>0) ans+=n*i;
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
15
history_source/信息学奥赛一本通/1.4.4.11.cpp
Normal file
15
history_source/信息学奥赛一本通/1.4.4.11.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int ans=0,a,b,c;
|
||||
cin>>a>>b>>c;
|
||||
for(int i=0;i<=c/a+1;i++)
|
||||
{
|
||||
for(int j=0;j<=(c-i*a)/b+1;j++)
|
||||
if(i*a+j*b==c) ans++;
|
||||
}
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.4.4.2.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.4.2.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
long long times=1;
|
||||
double ans=0;
|
||||
scanf("%d",&n);
|
||||
for(int i=1;i<=n;i++)
|
||||
{
|
||||
times*=i;
|
||||
ans+=1.0/times;
|
||||
}
|
||||
printf("%.10lf\n",ans+1);
|
||||
return 0;
|
||||
}
|
||||
|
18
history_source/信息学奥赛一本通/1.4.4.3.cpp
Normal file
18
history_source/信息学奥赛一本通/1.4.4.3.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<cstdio>
|
||||
#include<cmath>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
float x;
|
||||
int n;
|
||||
scanf("%f%d",&x,&n);
|
||||
float ans=0,times=1;
|
||||
for(int i=0;i<=n;i++)
|
||||
{
|
||||
ans+=times;
|
||||
times*=x;
|
||||
}
|
||||
printf("%f\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
23
history_source/信息学奥赛一本通/1.4.4.4.cpp
Normal file
23
history_source/信息学奥赛一本通/1.4.4.4.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
bool is(int n)
|
||||
{
|
||||
if(n%7==0) return 0;
|
||||
do
|
||||
{
|
||||
if(n%10==7) return 0;
|
||||
n/=10;
|
||||
}
|
||||
while(n);
|
||||
return 1;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
int ans=0;
|
||||
for(int i=1;i<=n;i++)
|
||||
if(is(i)) ans+=i*i;
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
17
history_source/信息学奥赛一本通/1.4.4.5.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.4.5.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
string a;
|
||||
int n;
|
||||
stringstream li;
|
||||
cin>>n;
|
||||
for(int i=1;i<=n;i++) li<<i;
|
||||
li>>a;
|
||||
int ans=0;
|
||||
for(int i=0;i<a.size();i++) if(a[i]=='1') ans++;
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
17
history_source/信息学奥赛一本通/1.4.4.6.cpp
Normal file
17
history_source/信息学奥赛一本通/1.4.4.6.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include<iostream>
|
||||
#include<sstream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
string a;
|
||||
int l,r;
|
||||
stringstream li;
|
||||
cin>>l>>r;
|
||||
for(int i=l;i<=r;i++) li<<i;
|
||||
li>>a;
|
||||
int ans=0;
|
||||
for(int i=0;i<a.size();i++) if(a[i]=='2') ans++;
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
23
history_source/信息学奥赛一本通/1.4.4.7.cpp
Normal file
23
history_source/信息学奥赛一本通/1.4.4.7.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int x,y;
|
||||
bool s;
|
||||
char c;
|
||||
cin>>y>>x>>c>>s;
|
||||
for(int i=0;i<x;i++) cout<<c;
|
||||
cout<<endl;
|
||||
for(int i=1;i<y-1;i++)
|
||||
{
|
||||
cout<<c;
|
||||
if(s) for(int i=1;i<x-1;i++) cout<<c;
|
||||
else for(int i=1;i<x-1;i++) cout<<' ';
|
||||
cout<<c;
|
||||
cout<<endl;
|
||||
}
|
||||
for(int i=0;i<x;i++) cout<<c;
|
||||
cout<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
22
history_source/信息学奥赛一本通/1.4.4.8.cpp
Normal file
22
history_source/信息学奥赛一本通/1.4.4.8.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
bool isp(int n)
|
||||
{
|
||||
for(int i=2;i*i<=n;i++) if(n%i==0) return 0;
|
||||
return 1;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
long long n;
|
||||
cin>>n;
|
||||
for(int i=2;i*i<=n;i++)
|
||||
{
|
||||
if(isp(i)&&n%i==0)
|
||||
{
|
||||
cout<<n/i<<endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
24
history_source/信息学奥赛一本通/1.4.4.9.cpp
Normal file
24
history_source/信息学奥赛一本通/1.4.4.9.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
bool isp(int n)
|
||||
{
|
||||
for(int i=2;i*i<=n;i++) if(n%i==0) return 0;
|
||||
return 1;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
long long p;
|
||||
cin>>n;
|
||||
for(long long i=2,j=0;j<n;i++)
|
||||
{
|
||||
if(isp(i))
|
||||
{
|
||||
p=i;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
cout<<p<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.5.1.1.cpp
Normal file
16
history_source/信息学奥赛一本通/1.5.1.1.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
int a[n];
|
||||
for(int i=0;i<n;i++) scanf("%d",a+i);
|
||||
int m;
|
||||
scanf("%d",&m);
|
||||
int ans=0;
|
||||
for(int i=0;i<n;i++) ans+=(a[i]==m);
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
25
history_source/信息学奥赛一本通/1.5.1.10.cpp
Normal file
25
history_source/信息学奥赛一本通/1.5.1.10.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
bool check(int lesson[7])
|
||||
{
|
||||
for(int i=0;i<7;i++) if(lesson[i]>8) return 0;
|
||||
return 1;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int lesson[7],a,b;
|
||||
for(int i=0;i<7;i++)
|
||||
{
|
||||
scanf("%d%d",&a,&b);
|
||||
lesson[i]=a+b;
|
||||
}
|
||||
if(check(lesson)) printf("0\n");
|
||||
else
|
||||
{
|
||||
int max=0;
|
||||
for(int i=1;i<7;i++) if(lesson[i]>lesson[max]) max=i;
|
||||
printf("%d\n",max+1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
18
history_source/信息学奥赛一本通/1.5.1.11.cpp
Normal file
18
history_source/信息学奥赛一本通/1.5.1.11.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,max,min,x;
|
||||
scanf("%d",&n);
|
||||
scanf("%d",&x);
|
||||
max=min=x;
|
||||
for(int i=1;i<n;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
if(x<min) min=x;
|
||||
if(x>max) max=x;
|
||||
}
|
||||
printf("%d\n",max-min);
|
||||
return 0;
|
||||
}
|
||||
|
18
history_source/信息学奥赛一本通/1.5.1.12.cpp
Normal file
18
history_source/信息学奥赛一本通/1.5.1.12.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n,max=-100000000;
|
||||
unsigned long long ans=0;
|
||||
scanf("%d",&n);
|
||||
int a[n];
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
scanf("%d",a+i);
|
||||
if(a[i]>max) max=a[i];
|
||||
}
|
||||
for(int i=0;i<n;i++) if(a[i]<max) ans+=a[i];
|
||||
printf("%lld\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
37
history_source/信息学奥赛一本通/1.5.1.13.cpp
Normal file
37
history_source/信息学奥赛一本通/1.5.1.13.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
double abs(double n)
|
||||
{
|
||||
if(n<0) n=-n;
|
||||
return n;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
double bai[n];
|
||||
double max,min,add;
|
||||
scanf("%lf",bai);
|
||||
add=max=min=bai[0];
|
||||
for(int i=1;i<n;i++)
|
||||
{
|
||||
scanf("%lf",bai+i);
|
||||
if(bai[i]>max) max=bai[i];
|
||||
if(bai[i]<min) min=bai[i];
|
||||
add+=bai[i];
|
||||
}
|
||||
double p=(add-max-min)/(n-2);
|
||||
printf("%.2lf ",p);
|
||||
double maxn;
|
||||
int i=0;
|
||||
while(bai[i]==max||bai[i]==min) i++;
|
||||
maxn=abs(p-bai[i]);
|
||||
i++;
|
||||
for(;i<n;i++)
|
||||
{
|
||||
if(abs(p-bai[i])>maxn&&bai[i]!=max&&bai[i]!=min) maxn=abs(p-bai[i]);
|
||||
}
|
||||
printf("%.2lf\n",maxn);
|
||||
return 0;
|
||||
}
|
||||
|
20
history_source/信息学奥赛一本通/1.5.1.14.cpp
Normal file
20
history_source/信息学奥赛一本通/1.5.1.14.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include<iostream>
|
||||
#include<algorithm>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
int num[n];
|
||||
for(int i=0;i<n;i++) cin>>num[i];
|
||||
sort(num,num+n);
|
||||
int j=0;
|
||||
for(int i=0;i<=num[n-1];i++)
|
||||
{
|
||||
int add=0;
|
||||
while(num[j]==i) add++,j++;
|
||||
cout<<add<<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
26
history_source/信息学奥赛一本通/1.5.1.15.cpp
Normal file
26
history_source/信息学奥赛一本通/1.5.1.15.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
int a[n];
|
||||
for(int i=0;i<n;i++) cin>>a[i];
|
||||
int maxn,max,num;
|
||||
num=a[0];
|
||||
maxn=max=1;
|
||||
for(int i=1;i<n;i++)
|
||||
{
|
||||
if(num==a[i]) max++;
|
||||
else
|
||||
{
|
||||
if(max>maxn) maxn=max;
|
||||
max=1;
|
||||
num=a[i];
|
||||
}
|
||||
}
|
||||
if(max>maxn) maxn=max;
|
||||
cout<<maxn<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
25
history_source/信息学奥赛一本通/1.5.1.16.cpp
Normal file
25
history_source/信息学奥赛一本通/1.5.1.16.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
vector<int>a;
|
||||
int n;
|
||||
cin>>n;
|
||||
a.resize(n);
|
||||
for(int i=0;i<n;i++) cin>>a[i];
|
||||
for(int i=0;i<a.size();i++)
|
||||
{
|
||||
for(int j=i+1;j<a.size();j++)
|
||||
{
|
||||
if(a[j]==a[i])
|
||||
{
|
||||
a.erase(a.begin()+j);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=0;i<a.size();i++) cout<<a[i]<<" ";
|
||||
return 0;
|
||||
}
|
||||
|
26
history_source/信息学奥赛一本通/1.5.1.17.cpp
Normal file
26
history_source/信息学奥赛一本通/1.5.1.17.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
struct ditan
|
||||
{
|
||||
int x,y,xa,ya;
|
||||
};
|
||||
bool f(ditan t,int x,int y)
|
||||
{
|
||||
if(t.x<=x&&t.x+t.xa>=x&&t.y<=y&&t.y+t.ya>=y) return 1;
|
||||
return 0;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
ditan d[n];
|
||||
for(int i=0;i<n;i++) cin>>d[i].x>>d[i].y>>d[i].xa>>d[i].ya;
|
||||
int x,y;
|
||||
cin>>x>>y;
|
||||
int ans=-2;
|
||||
for(int i=0;i<n;i++)
|
||||
if(f(d[i],x,y)) ans=i;
|
||||
cout<<ans+1<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
14
history_source/信息学奥赛一本通/1.5.1.2.cpp
Normal file
14
history_source/信息学奥赛一本通/1.5.1.2.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int h[10];
|
||||
for(int i=0;i<10;i++) scanf("%d",h+i);
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
int ans=0;
|
||||
for(int i=0;i<10;i++) if(h[i]<=n+30) ans++;
|
||||
printf("%d\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
16
history_source/信息学奥赛一本通/1.5.1.3.cpp
Normal file
16
history_source/信息学奥赛一本通/1.5.1.3.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
double prise[10]={28.9,32.7,45.6,78,35,86.2,27.8,43,56,65};
|
||||
double ans=0;
|
||||
int x;
|
||||
for(int i=0;i<10;i++)
|
||||
{
|
||||
scanf("%d",&x);
|
||||
ans+=prise[i]*x;
|
||||
}
|
||||
printf("%.1lf\n",ans);
|
||||
return 0;
|
||||
}
|
||||
|
12
history_source/信息学奥赛一本通/1.5.1.4.cpp
Normal file
12
history_source/信息学奥赛一本通/1.5.1.4.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include<cstdio>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d",&n);
|
||||
int a[n];
|
||||
for(int i=0;i<n;i++) scanf("%d",a+i);
|
||||
for(int i=n-1;i>=0;i--) printf("%d ",a[i]);
|
||||
return 0;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user