精進
昆布で精進
AOJ 2100
#include <cstdio> #include <cmath> using namespace std; int main() { int t,n,h,oldh; scanf("%d",&t); for (int ix=0; ix<t; ix++) { int max=0,min=0; scanf("%d",&n); scanf("%d",&oldh); for (int i=0; i<n-1; i++) { scanf("%d",&h); int diff=h-oldh; oldh=h; if (max<diff) max=diff; else if (min>diff) min=diff; } printf("%d %d\n",max,min*-1); } }
AOJ 0555
#include <iostream> #include <string> using namespace std; int main() { string ring,str; int N,res=0; cin>>str>>N; for (int i=0; i<N; i++) { cin>>ring; bool flag=false; for (int j=0; j<10; j++) { int at=j; string tmp=""; for (int k=0; k<str.length(); k++) { if (at==10) at=0; tmp+=ring[at]; at++; } if (tmp==str) { flag=true; break; } } if (flag) res++; } cout<<res<<endl; }
AOJ 0554
#include <cstdio> using namespace std; int main() { int total=0, tmp; for (int i=0; i<4; i++) { scanf("%d",&tmp); total+=tmp; } printf("%d\n%d\n",total/60,total%60); }
AOJ 0136
#include <cstdio> #include <vector> using namespace std; int main() { int n; float high; vector<int> num(6,0); scanf("%d",&n); for (int i=0; i<n; i++) { scanf("%f",&high); if (high<165.0) { num[0]++; } else if (high<170.0) { num[1]++; } else if (high<175.0) { num[2]++; } else if (high<180.0) { num[3]++; } else if (high<185.0) { num[4]++; } else { num[5]++; } } for (int i=1; i<=6; i++) { printf("%d:",i); for (int j=0; j<num[i-1]; j++) printf("*"); printf("\n"); } }
PKU3749の問題に既視感