跳到正文

个人记录

比赛

joe303约 2 分钟
原文
文章信息与版本

文章信息

发布
2025年8月5日
收录
2026年8月14日
更新
2026年11月13日
篇幅
约 2 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
#include <windows.h>
using namespace std;
string s[15]= {
	{"#.............."},
	{".#............."},
	{"..#............"},
	{"...#..........."},
	{"....#.........."},
	{".....#........."},
	{"......#........"},
	{".......#......."},
	{"........#......"},
	{".........#....."},
	{"..........#...."},
	{"...........#..."},
	{"............#.."},
	{".............#."},
	{"..............#"}
} ;
int a[4],n,maxn=-1,m;
string ming[4]={"IOI","ICPC","乐多","OI"};
int main() {
	srand(time(0));
	for(int i=1;i<=15;i++){
		system("cls");
		cout<<s[i-1]<<"\n";
		n=rand()%4;
		cout<<"第"<<i<<"名选择了"<<ming[n];
		a[n]++;
		Sleep(1000);
	}
	system("cls");
	cout<<"投票结果\n";
	system("color E");
	for(int i=0;i<4;i++) cout<<ming[i]<<" "<<a[i]<<'\n'; 
	Sleep(5000);
	system("cls");
	system("color CE");
	cout<<"最终结果"<<endl;
	for(int i=0;i<4;i++){
		if(a[i]>maxn){
			maxn=a[i];
			m=i;
		}
	}
	cout<<ming[m]<<":"<<maxn;
	return 0;
}
原文