AtCoder ABC278 A-F

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++
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值