0
已解决
李致远
高级光能
高级光能
#include<Windows.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<conio.h>
#include<cstdlib>
#include<queue>
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
using namespace std;
void HideCursor() {
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}
void be_swaped(int *x, int *y) {
int tmp = *x;
*x = *y;
*y = tmp;
}
void be_swap(int *a, int *b, int *c) {
be_swaped(a, c);
//be_swaped(b, c);
}
void out(string s, int n) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(n);
}
}
void gotoxy(int x, int y, int z, string s) {
for(int i = 1; i <= x; i++) {
if(i == x) {
for(int j = 1; j <= y - s.size(); j++) {
cout << " ";
}
} else {
for(int j = 1; j <= y; j++) {
cout << " ";
}
cout << endl;
}
}
for(int i = 1; i <= x; i++) {
cout << " ";
}
out(s, z);
}
void gz() {
out("This learning tool is made by Li Zhiyuan, not reproduced without permission!",80);
cout<<endl;
out("Some tools may need VIP, VIP needs 50 learning points to buy!",80);
cout<<endl;
out("Gain 5 learning points per operation!",80);
cout<<endl;
Sleep(1000);
//out("按F键打开翻译",80);
//char s=getch();
//if(s=='F')system("start https://fanyi.baidu.com/translate#en/zh/This%20learning%20tool%20is%20made%20by%20Li%20Zhiyuan%2C%20not%20reproduced%20without%20permission!%0ASome%20tools%20may%20need%20VIP%2C%20VIP%20needs%20200%20learning%20points%20to%20buy!Gain%205%20learning%20points%20per%20operation!");
return ;
}
void ysf(){
int n,m;
out("Input:",80);
cin>>n>>m;//n表示人数,m表示报到几的人退出
queue<int> q;
for(int i=1;i<=n;i++){
q.push(i);
}
int cur=1;
while(q.size()>1){
int x=q.front();
q.pop();
if(cur==m){
cur=1;
}
else{
q.push(x);
cur++;
}
}
cout<<endl<<q.front()<<endl;
}
int main() {
HideCursor();
out("This code is used to be to study", 100);
cout<<endl;
out(" ——by 李致远",80);
cout<<endl;
system("cls");
out("这个学习工具是全英文版的!若要查看译文,请打开https://fanyi.baidu.com/translate#en/zh/This%20learning%20tool%20is%20made%20by%20Li%20Zhiyuan%2C%20not%20reproduced%20without%20permission!%0ASome%20tools%20may%20need%20VIP%2C%20VIP%20needs%20200%20learning%20points%20to%20buy!Gain%205%20learning%20points%20per%20operation!%0AThis%20code%20is%20used%20to%20be%20to%20study%0A0%20josephus%20problem%20%0A1%20swap%20%0A2%20gcd(VIP)%20%0A3%20triangle(VIP)%0A%204%20exit%20%0A5%20view%20the%20rules%0A%206%20buy%20the%20VIP%0AHint%3Athis%20triangle%20must%20be%20a%20Right%20Angle%20triangle!!!",20);
cout<<endl;
system("pause");
Sleep(1000);
system("cls");
int vip=0,jb=0;
while(1) {
out("0 josephus problem 1 swap 2 gcd(VIP) 3 triangle(VIP) 4 exit 5 view the rules 6 buy the VIP", 100);
cout<<endl;
char a = getch();
if(a=='0'){
ysf();
}
if(a == '1') {
jb+=5;
system("cls");
out("number?",100);
out("(2/3)",100);
cout<<endl;
char b=getch();
if(b=='2') {
cout<<"Input:";
int c,d;
cin>>c>>d;
cout<<endl;
//c-='0';
//d-='0';
swap(c,d);
cout<<c<<" "<<d;
}
if(b=='3') {
cout<<"Input:";
int c,d,e;
cin>>c>>d>>e;
cout<<endl;
//c-='0';
//d-='0';
//e-='0';
swap(c,e);
cout<<c<<" "<<d<<" "<<e;
}
}
if(a=='2') {
if(vip==1) {
jb+=5;
system("cls");
out("Input:",80);
int c,d;
cin>>c>>d;
out("\nThe gcd are:",80);
cout<<__gcd(c,d);
} else {
out("You do not have VIP!",80);
}
}
if(a=='3') {
if(vip==1) {
jb+=5;
out("Hint:this triangle must be a Right Angle triangle!!!",100);
Sleep(1000);
system("cls");
out("side1 and side2:",100);
int b,c;
cin>>b>>c;
//b-='0';
//c-='0';
cout<<endl;
out("The side3 are:",100);
double q=sqrt(b*b+c*c);
printf("%.2f",q);
} else {
out("You do not have VIP!",80);
}
}
if(a=='4')return 0;
if(a=='5')gz();
if(a=='6') {
Sleep(1000);
system("cls");
out("Now you have",80);
cout<<jb;
out("coins,what do you want to buy?",80);
cout<<endl;
out("1 VIP cost 200 coins",80);
char d=getch();
cout<<endl;
if(d=='1') {
if(jb>=50) {
out("OK!",80);
jb-=50;
vip=1;
} else {
out("Sorry!",80);
}
}
}
Sleep(1500);
system("cls");
}
return 0;
}
0
0
0
0
0
0
0
0