牛客——西安邮电大学第五届ACM-ICPC校赛(同步赛)

A-拯救咕咕咕之史莱姆

在这里插入图片描述

/*
* problem:拯救咕咕咕之史莱姆
* method:模拟、找规律
* date:2020/07/10
*/
#include<iostream>
#define LL long long
using namespace std;
long long f[10],s[10];
int main(){
	long long i,j;
	for(i=1;i<=4;i++){
		f[i]=i;
	}
	for(i=5;i<10;i++){
		f[i]=f[i-1]+i-3;
	}
	for(i=1;i<10;i++){
		for(j=1;j<=i;j++)
			s[i]+=f[j]*3;
		//cout<<s[i]<<endl;
	}
	long long n;
	while(cin>>n){
		if(!n) break;
		if(s[6]>=n) cout<<"AOLIGEI!"<<endl;
		else cout<<"DAAAAAMN!"<<endl;
	}
	return 0;
}

E-无敌阿姨

在这里插入图片描述

/*
* problem:无敌阿姨
* method:模拟
* date:2020/07/10
*/
#include<iostream>
#define LL long long
using namespace std;
int n,m,k,t;
int main() {
	cin>>t;
	while(t--) {
		int i,num=1,x,t;
		cin>>n>>m>>k;
		t=m;
		while(n--) {
			cin>>x;
			while(x>t) {
				x-=t;
				t=m;
				num++;
			}
			t-=x;
			if(n&&t<=k) {
				num++;
				t=m;
			} else {
				t-=k;
			}
		}
		cout<<num<<endl;
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/The_Only_God/article/details/107269627