- C20250050's blog
UID <-> ID
- 2024-3-24 10:39:06 @
可能会计算错存在留级、转学、退学、bs等情况的同学或班级,请谅解。(例如:25届10班5号和之后的学号)
Dev-c++上开启 -std=c++11 可用。
#include<set>
#include<stdio.h>
#include<algorithm>
#include<conio.h>
#include<windows.h>
using namespace std;
int a[10][15] = {
{3, 123, 164, 205, 246},
{12, 2, 42, 82, 579, 620, 661, 702, 744, 786, 827, 868, 910, 951},
{12, 1152, 1189, 1224, 1261, 1303, 1345, 1388, 1431, 1473, 1514, 1557, 1599, 1641}
};
int mode = 0;
char getlimitch(initializer_list<char> sig){
set<char>s;
for (char c : sig) s.insert(c);
char ch = getch();
while (!s.count(ch)) ch = getch();
return ch;
}
void links(int uid){
string s = "";
while (uid){
s = (char)(uid % 10 + '0') + s;
uid /= 10;
}
puts("");
puts(("主页链接(内网):http://10.80.74.11/user/" + s).c_str());
puts(("主页链接(外网):http://hfoj.net/user/" + s).c_str());
puts(("主页链接(Markdown):[主页链接](/user/" + s + ")").c_str());
puts(("博客链接(内网):http://10.80.74.11/blog/" + s).c_str());
puts(("博客链接(外网):http://hfoj.net/blog/" + s).c_str());
puts(("博客链接(Markdown):[博客链接](/blog/" + s + ")").c_str());
}
void f();
void g();
void h();
void f(){
system("cls");
puts ("按 1 UID 转学号\n按 2 学号转 UID\n按 esc 退出");
char ch = getlimitch({'1', '2', (char)27});
if (ch == '1')
mode = 1;
else if (ch == '2')
mode = 2;
else
exit(0);
}
void g(){
system("cls");
printf ("请输入 UID:");
int uid;
scanf ("%d", &uid);
if (uid == 87) puts("\n喵喵喵\n");
if (uid <= 0) puts("找不到用户");
else {
if (uid == 1) puts("您是Hydro管理员");
else if (uid == 2) puts("您是梁老师");
else if (uid == 123) puts("您是徐老师");
else if (uid == 247) puts("您是tokawah");
else {
bool f = 1;
for (int i = 0;i < 3 && f;++i)
for (int j = 1;j <= a[i][0] && f;++j)
if (a[i][j] < uid && uid <= a[i][j + 1]){
if (i == 1 && j == 3 && uid - a[i][j] > 40) continue;
f = 0;
printf ("您是 %d 届 %d 班 %d 号,%04d\n", 24 + i, j, uid - a[i][j], j * 100 + uid - a[i][j]);
}
if (f)
puts("您是自创用户/找不到用户");
}
links(uid);
}
puts("");
puts("按任意键继续");
char ch = getch();
mode = 0;
}
void h(){
system("cls");
printf ("请输入年级(期望毕业时所在年份-2000):");
int gd;
scanf ("%d", &gd);
gd -= 24;
if (gd < 0 || gd >= 3) puts ("暂无该年级数据");
else {
printf ("请输入班级:");
int cl;
scanf ("%d", &cl);
if (cl <= 0 || cl > a[gd][0]) puts ("暂无该班级数据");
else {
printf ("请输入学号:");
int id, uid;
scanf ("%d", &id);
if (id <= 0 || id > a[gd][cl+1] - a[gd][cl] || (gd == 1 && cl == 3 && id > 40)) puts ("暂无该学号数据");
else {
uid = a[gd][cl] + id;
if (uid == 87) puts("\n喵喵喵\n");
printf ("您的 UID 可能是:%d\n", uid);
links(uid);
}
}
}
puts("");
puts("按任意键继续");
char ch = getch();
mode = 0;
}
int main(){
while (true){
if (mode == 0) f();
if (mode == 1) g();
if (mode == 2) h();
}
return 0;
}