跳到正文

jinyukai316

1654665

这个家伙很懒,但他留下了什么

在洛谷打开
资料、奖项与版本

资料

编号
1654665
抓取

十年OIOI一场空,不开longlong longlong见祖宗!

金yu剀的个入介绍

☑ ♓座 boy

MC(AC\color{#22AB22} AC)、florr.io爱好者

代码
☴     ☲     ☷

☳     ☯     ☱

☶     ☵     ☰

我的程序:

编译运行.cpp
C++
#include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
void sb(string s){
    for(int i=0;s[i]!='\0';i++){
        Sleep(50);
        cout<<s[i];
    }
}
void wa(string a,int f){
	cout<<a<<setw(10)<<f<<endl;Sleep(100);
	if(a=="Time Excssded")Sleep(500);
}
int main(){
	sb("0 Waiting");Sleep(500);system("cls");
	sb("0 Compiling");Sleep(500);system("cls");
	sb("0 Running");Sleep(500);system("cls");
	sb("0 Wrong Answer\n");
	for(int i=1;i<=5;i++){
		wa("Wrong Answer",0);
	}
	for(int i=1;i<=5;i++){
		wa("Time Excssded",0);
	}
	_getch();
	return 0;
}
猜数.cpp
C++
#include <iostream>
#include<conio.h>
#include<stdlib.h>
#include<time.h>
#include<windows.h>
using namespace std;
void Start();
void game();
int i, j, life, maxrand;
char c;
void Start() {
	i = 0;
	j = 0;
	life = 0;
	maxrand = 6;
	cout<<"请选择难度:\n"; // the user has to select a difficutly level
	cout<<"1 : 简单 (0-15)\n";
	cout<<"2 : 中等 (0-30)\n";
	cout<<"3 : 困难 (0-50)\n";
	cout<<"或者点其他按键以退出\n";
	c=30;
	c=_getch();                   // read the user's choice
	cout<<endl;
	switch (c) {
		case '1':
			maxrand = 15;  // the random number will be between 0 and maxrand
			break;
		case '2':
			maxrand = 30;
			break;
		case '3':
			maxrand = 50;
			break;
		default:
			cout<<"确定退出?(0:不退出;1:退出)";
			if(_getch()=='1')exit(0);
			else break;
		break;
	}
	life = 5;         // number of lifes of the player
	srand((unsigned)time(NULL)); // init Rand() function
	j = rand() % maxrand;  // j get a random value between 0 and maxrand
	game();
}
void game() {
	if (life <= 0) { // if player has no more life then he loses
		cout<<"你输了!\n\n";
		system("cls");
		Start();
	}
	cout<<"猜一个数: \n";
	cin >> i;
	if((i>maxrand) || (i<0)) { // if the user number isn't correct, restart'
		cout<<"错误:这个数不在1和"<<maxrand<<"之间";
		game();
	}
	if(i == j) {
		cout<<"你赢了!\n\n"; // the user found the secret number
		Sleep(3000);
		system("cls");
		Start();
	} else if(i>j) {
		cout<<"太大了!\n";
		life=life-1;
		cout<<"还有: "<<life<<"条命\n\n";
		game();
	} else if(i<j) {
		cout << "太小了!\n";
		life = life - 1;
		cout << "还有: " << life << "条命\n\n";
		game();
	}
}
int main() {
	cout<<"** 猜数 **\n";
	cout<<"你要在游戏里猜一个数。\n";
	cout<<"程序会告诉你这个数是太大了还是太小了,\n";
	cout<<"以帮助你找到那个数\n\n";
	system("pause");
	system("cls");
	Start();
	return 0;
}

ฏ้้้้้้้้้้้้้้้้้้้้้้้้้้้้้

我的其他

P1024_2.in: 1 -4.65 2.25 1.4

P1024_2.out: -0.35 1.00 4.00

other 中的 other:

太极虫

Photos:

AC

救急传送门:

优先队列

string

队列queue

vector

C++
#include<bits/stdc++.h>
using namespace std;
int t;
string st;
int main(){
	cin>>t;
	for(int h=1;h<=t;h++){
		st="";cin>>st;
		int f=0;
		for(int i=0;i<st.size();i++)if(isupper(st[i]))f++;
		f=abs(5-f);
		if(st.size()==5){
			cout<<"0\n";continue;
		}
		else if(!f){
			cout<<"0\n";
		}
		else if(st.size()>5&&st.size()<=10){
			cout<<min(int(st.size()-5),f)<<"\n";
		}
		else if(st.size()<5)cout<<2*(5-st.size())<<"\n";
		else cout<<min(f,5)<<"\n";
	}
	return 0;
}

CF607B

C++
#include<bits/stdc++.h>
using namespace std;
int n;int a[1010];
int f[1010][1010];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++)f[i][i]=1;
	for(int h=1;h<=n;h++){
		for(int i=1;i+h<=n;i++){
			int j=i+h;
			f[i][j]=INT_MAX;
			for(int k=i;k<j;k++){
				f[i][j]=min(f[i][j],f[i][k]+f[k+1][j]);
				if(a[i]==a[j]&&i+1!=j)f[i][j]=min(f[i][j],f[i+1][j-1]);
				if(a[i]==a[j]&&i+1==j)f[i][j]=1;
			}
//			cout<<"f["<<i<<"]["<<j<<"]="<<f[i][j]<<"\n"; 
		}
	}
	cout<<f[1][n];
}

还没有收录这位用户的文章。