跳到正文

个人记录

命中注定

linshangyuan约 1 分钟
原文
文章信息与版本

文章信息

发布
2024年8月27日
收录
2025年12月12日
更新
2026年8月31日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
#include <ctime>
#include <cstdlib>
using namespace std;
int lcr;
int ans,sum,cnt,xiong,daxiong;
int main() {
	int i , a , b , c = 0;
	srand( (unsigned)time(NULL));
	for(int i = 1; i <= i; i++) {
		a = rand();
		b = rand();
		if(a == b) a = c;
		cout<<"随机数"<<i<<":"<<a<<" "<<b<<" "<<c<<endl;
		if(c != 0/*命中注定*/ ) {
			cout<<"I love you lcr"<<endl;
			return 0;
		}
		if( a + 1 == b/*大吉*/ ) ans++;
		if(a * 2 == b /*小吉*/)sum++;
		if(a * a == b /*中平*/)cnt++;
		if(a * 2 + 1 == b /*凶*/) xiong++;
		if(i > 52029548) {
			if(lcr == 0 && ans == 0 && sum == 0 && cnt == 0 && xiong == 0)
			cout <<daxiong<<endl;    // 大凶
			return 0;
		}
	}
	getchar();
	return 0;
}
原文