A - Shift
不讲。
#include<bits/stdc++.h>
using namespace std;
int n,m,a[110];
int main(){
cin>>n>>m;
for(int i=1;i<=n;++i) cin>>a[i];
for(int i=m+1;i<=n;++i) cout<<a[i]<<' ';
for(int i=n+1;i<=min(m+n,n+n);++i) cout<<0<<' ';
cout<<endl;
return 0;
}
B - Misjudge the Time
题目大意:若一个时间 h h : m m hh:mm hh:mm 按 2 × 2 2\times 2 2×2 矩阵排布,若这个时间竖着读和横着读都合法,就称这个时间是 c o n f u s i n g confusing confusing t i m e time time 。现给定某时间 h h : m m hh:mm hh:mm ,问下一个(包括这个时间) c o n f u s i n g confusing confusing t i m e time time 是多少。
简单模拟,不讲。
#include<bits/stdc++.h>
using namespace std;
bool check(int x,int y){
if(x>=0&&x<24&&y>=0&&y<60) return 1;
return 0;
}
int h,m;
bool vh[110][110];
int main(){
for(int i=0;i<=9;++i)
for(int j=0;j<=9;++j)
for(int k=0;k<=9;++k)
for(int l=0;l<=9;++l)
if(check(i*10+j,k*10+l)) vh[i*10+j][k*10+l]=1;
cin>>h>>m;
int h1=h/10,h2=h%10,m1=m/10,m2=m%10;
while(!vh[h1*10+m1][h2*10+m2]){
m2++;
if(m2==10) m1++