跳到正文

剪贴板

剪贴板 125xpfnb

原文
剪贴板信息

剪贴板信息

收录
更新
C++
#include<bits/stdc++.h>
using namespace std;
deque<int>q[15];
int m[15],res;
int t[15];
string ss;
int n,y,r;
string xx[15]={"极凶","大凶","大凶","凶","小凶","小凶","中庸","小吉","小吉","吉","大吉","大吉","满堂开花,极吉"};
int main(){
	srand(time(0));
	cin>>ss>>n>>y>>r;
	for(int i=1;i<=13;i++){
		for(int j=1;j<=4;j++){
			int s=(rand()-1)%13+1;
			while(t[s]==4){
				s=(rand()-1)%13+1;
			}
			t[s]++;
			q[i].push_back(s);
		}
	}
	while(!q[13].empty()){
		int x=q[13].front();
		q[13].pop_front();
		while(1){
			if(x==13){
				break;
			}
			q[x].push_front(x);
			m[x]++;
			if(m[x]>=4)res++;
            int p=q[x].back();
			q[x].pop_back();
			x=p;
		}
	}
	cout<<ss<<n<<"年"<<y<<"月"<<r<<"日的运势是"<<xx[res];
	/*printf("%s%d年%d月%d日的运势是",ss,n,y,r);
	cout<<xx[res];*/
	return 0;
}

个人声明:此代码纯属娱乐,无不良指导。