首页 > 其他 > 详细

codevs 天梯青铜题解

时间:2015-08-14 13:12:45      阅读:158      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!