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); }
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); }
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"; }
T1206:
#include<cstdio> double a; int main() { scanf("%lf",&a); printf("%.2lf\n",a); }
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; }
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"; }
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"; }