慕浩然
就是我啦
那些值得纪念的事:
2021.7.19 注册洛谷;
2021.10(日期也忘了)CSP-J2 一等奖!!(然而只有260多分)
2022.1.1(元旦当天)贺题破100!
2022.8.2 紫题祭(P2446大陆争霸)
2022.9~10 莫名发现蓝名
2023.2~3 NOIP春测及省选等(本来就菜还非要试一试)
2023.11 NOIP2023
附上自己制作的一些小东西: 1.贪吃蛇:
#include <iostream> //cout<<;cin>>;
#include <ctime> //time();
#include <cstdlib> //srand();rand();
#include <conio.h> //getch();
#include <windows.h> //Sleep();system();
#include <cstring> //strlen();
using namespace std;
const int N=100,S=10;
struct Point {
int x,y;
}snake[N+5],dollar;
int shead,stail,slen,dire;
char mp[S][S];
int py[] = {1,0,-1,0};
int px[] = {0,1,0,-1};
void putlog(char log[]) {
int len = strlen(log),i;
for (i=0;i<len;i++) {
cout<<log[i];
Sleep(log[i]=='\n'?1000:100);
}
}
void printmap() {
int i,j;
system("cls");
cout<<"Score: "<<slen<<endl;
for (i=0;i<S;i++) {
for (j=0;j<S;j++) {
cout<<' '<<mp[i][j];
}cout<<endl;
}
}
void start() {
int i,j;
srand(time(0));
slen = 1;
shead=0;stail=(shead-slen+N)%N;
dollar.x = rand()%S;
dollar.y = rand()%S;
}
bool update() {
int i,j;
for (i=0;i<S;i++) {
for (j=0;j<S;j++) {
mp[i][j] = '.';
}
}
for (i=stail;i!=shead;i=(i+1)%N) {
mp[snake[i].x][snake[i].y] = '*';
}
if (mp[snake[shead].x][snake[shead].y]=='*') return 1;
mp[snake[shead].x][snake[shead].y] = '@';
mp[dollar.x][dollar.y] = '$';
return 0;
}
int main() {
int i;char c;
start();
putlog("You are a snake.\nYou need dollars to live.\nControl yourself with WASD.\nDon't let your head collide with your body.\nGood luck!");
update();
printmap();
for (;;) {
c = getch();
switch(c) {
case 'd': dire = 0;break;
case 's': dire = 1;break;
case 'a': dire = 2;break;
case 'w': dire = 3;break;
}
shead = (shead+1)%N;
snake[shead].x = (snake[(shead-1+N)%N].x+px[dire]+S)%S;
snake[shead].y = (snake[(shead-1+N)%N].y+py[dire]+S)%S;
if (snake[shead].x == dollar.x && snake[shead].y == dollar.y) {
slen++;
dollar.x = rand()%S;
dollar.y = rand()%S;
}
stail = (shead-slen+N+1)%N;
if (update()) break;
printmap();
}
system("cls");
Sleep(1000);
putlog("You died.\nYour score is: ");
Sleep(1000);
cout<<slen<<'.'<<endl;
return 0;
}2.(不是金山)打字通
#include <iostream>
#include <fstream>
#include <conio.h>
#include <ctime>
#include <string>
#include <windows.h>
using namespace std;
char str[105],c;
string line;
int sl,t1,t2,totl,tott;
double vel;
int main() {
int i;
cout<<"Enter the file_name here: ";cin>>str;
ifstream fin(str,ios::in);
if (!fin) {
cout<<"Error: Can't find such a file!"<<endl;
return 0;
}
t1 = time(0);
while (getline(fin,line)) {
sl = line.size();
totl += sl;
cout<<line<<endl;
for (i=0;i<sl;) {
c = getch();
if (c==line[i]) {
cout<<c;i++;
}
}
cout<<endl;
}
t2 = time(0);
tott = t2-t1;
vel = totl*1.0/tott;
cout<<endl;
cout<<"You typed "<<totl<<" letters in "<<tott<<" seconds."<<endl;
cout<<"Your average speed is "<<vel<<" letters per second."<<endl;
Sleep(1000);
return 0;
}