码迷,mamicode.com
首页 > 其他好文 > 详细

codevs 天梯青铜题解

时间:2015-08-14 13:15:58      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

一些很水的水题

 

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

 

codevs 天梯青铜题解

标签:

原文地址:http://www.cnblogs.com/Donnie-Darko/p/4729572.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!