codevs 天梯青铜题解

一些很水的水题

 

T1201:

#include<cstdio>
int min=0x7fffffff,max=-0x7fffffff;
int n,i,a;
int main()
{
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d",&a);
if (a>max) max=a;
if (a<min) min=a;
}
printf("%d %d\n",min,max);
}
View Code

T1202:

#include<cstdio>
int sum=0;
int n,i,a;
int main()
{
scanf("%d",&n);
for (i=1;i<=n;i++)
{
scanf("%d",&a);
sum+=a;
}
printf("%d\n",sum);
}
View Code

T1203:

#include <iostream>
#include <cmath>
using namespace std;
const double e=1e-8;
int main()
{
double a, b;
cin >> a >> b;
if ((a-e<=b&&b<=a+e)||(b-e<=a&&a<=b+e)) cout<<"yes";
else cout<<"no";
}
View Code

T1206:

#include<cstdio>
double a;
int main()
{
scanf("%lf",&a);
printf("%.2lf\n",a);
}
View Code

T2235:

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double a, b;
cin >> a >> b;
int tmp=a / 10 * b + 5;
cout << int(tmp / 10 * 10) << endl;
}
View Code

T1204:

#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int i;
string s,x;
int main()
{
int tot=0;
cin>>s>>x;
cout<<s.find(x)+1<<"\n";
}
View Code

T1205:

#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int i;
string s[10001];
int main()
{
int tot=0;
while(cin>>s[++tot]);
for (i=tot-1;i>=1;i--)
cout<<s[i]<<" ";
cout<<"\n";
}
View Code

 

posted @ 2015-08-14 11:50  Donnie_Darko  阅读(214)  评论(0编辑  收藏  举报