Codevs.cn的青铜组题目题解

 //1201
#include<cstdio>

int main()

{

int n,a,maxn=-1,minn=1e9;

scanf("%d",&a);

for(int i=1;i<=a;i++)

{

scanf("%d",&n);

if(n>=maxn)maxn=n;

if(n<=minn)minn=n;

}

printf("%d %d",minn,maxn);

return 0;

}
#include<cstdio>
//1202
int n;

int a;

int tot;

int main()

{

scanf("%d",&n);

for(int i=1;i<=n;i++)

{

scanf("%d",&a);

tot+=a;

}

printf("%d",tot);

return 0;

}

#include<cstdio>
//1203
#include<cmath>

using namespace std;

double a,b;

int main()

{

scanf("%lf %lf",&a,&b);

double tmp=abs(a-b);

if(tmp<=1e-8)printf("yes");

else printf("no");

return 0;

}

#include<cstdio>//1204
#include<cmath>
#include<cstring>
using namespace std;
char a[105],b[105];
int main()
{
	scanf("%s %s",&a,&b);
	int n = strlen(a);
	int m = strlen(b);
	int ans=0;
	for(int i=0;i<n;i++)
	{
		bool ok = 1;
		if(b[0]= a[0])
		{
			
			for(int j= 1;j< m;j++)
			{
				if(b[j]!=a[i+j])
				{
					ok=0;
					break;
				}
			}
			if(ok){ans=i+1;break;}
		}
	}
	printf("%d",ans);
	return 0;
}

1205

#include<iostream> 
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
using namespace std;
int main()
{
	stack<string> word;
	string tmp;
	while(cin>>tmp)
	{
		word.push(tmp);
	}
	while(!word.empty())
	{
		cout<<word.top()<<' ';
		//不知道怎么用printf输出string类的对象= = 
		word.pop();
	}
	return 0;
}

1206

#include<cstdio>

#include<cmath>

using namespace std;

double a;

int main()

{

scanf("%lf",&a);

printf("%.2lf",a);

return 0;

}

2235

#include<cstdio>
#include<cmath>
using namespace std;
int a;
double b;
int main()
{
	scanf("%d %lf",&a,&b);
	int ans =(int)(a*b/10);
	int m = ans % 10;
	if(m<5)ans-=m;
	else ans = ans + 10 - m;
	printf("%d",ans);
	return 0;
}


你可能感兴趣的:(Codevs.cn的青铜组题目题解)