江西 2022 CSP-J/S 奇葩代码合集
手翻。持续更新中。由于我是 J 组所以先更新 J 组的。
若发现你的代码被选中但是不想被公开可以私信我撤一下,也欢迎大家来认领代码。
总览:JX的J组280个参赛OIers总共写了1277个#include,159个iostream,38个cmath,875个万能头,44个#define int long long,14个rand(),4个114514
454个'//',3个ccf,本次JX的J组选手十分文明,代码中没有出现"f**k"
1.喜报://freopen
大概有69个freopen被注释掉
//freopen("decode.in", "r", stdin);
//freopen("decode.out", "w", stdout);
signed main() {
//int n, k;
cin >> n >> k;
for (int i = 1; i <= n; ++ i) {
cin >> P[i].x >> P[i].y;
}
Get(1);
cout << ans << '\n';
return 0;
}
2.cmath 人
#include <bits/stdc++.h>
using namespace std;
int main()
{
freopen("pow.in","r",stdin);
freopen("pow.out","w",stdout);
int a,b;
cin>>a>>b;
if(pow(a,b)>pow(10,9))
{
cout<<"-1";
}
else
{
cout<<pow(a,b);
}
return 0;
}
还有好多
3.No 人
T2是"NO"而不是"No",而JX-J00003的T2:
if(p[i]==0)
{
cout<<"No"<<endl;
}
4.张冠李戴人
JX-J00003的T3:
freopen("pow.in","r",stdin);
freopen("pow.out","w",stdout);
5.打表人
T3居然能打表,这是我没有想到的,但JX-J00004做到了.
cin>>s;
if(s.size()==1) cout<<s[0]<<endl<<0<<" "<<0;
if(s.size()==3){
if(s[1]=='&'){
if(s[0]=='0') cout<<0<<endl<<1<<" "<<0;
else if(s[2]=='0') cout<<0<<endl<<0<<" "<<0;
else cout<<1<<endl<<0<<" "<<0;
}
if(s[1]=='|'){
if(s[0]=='1') cout<<1<<endl<<0<<" "<<1;
else if(s[2]=='1') cout<<1<<endl<<0<<" "<<0;
else cout<<0<<endl<<0<<" "<<0;
}
}
6.(10,9)人
JX-J00005的T1:
if(n<(10,9))
7.样例人
JX-J00008的T3:
string u="(((((1&(0&0|1))...
8.天命打表人
就当我认为打表人很厉害时,我看到了JX-J00008
if(s.size()>5)
{
srand(unsigned(0));
cout<<rand()%2<<endl;
cout<<rand()%(s.size()/5)<<" "<<rand()%(s.size()/7)+1;
return 0;
}
...后接打表
9.bool值是2人
JX-J00010的T3,在经过一通我不理解的计算后,得到了bool值是2
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("expr.in","r",stdin);
freopen("expr.out","w",stdout);
string s;
cin>>s;
lens=s.size();
for(int i=1;i<=lens;i++){
if(s[i]=='0'){
az++;}
if(s[i]=='1'){
ax++;}
}
if(ax>az){
cout<<1<<endl;}
if(az%2==0){
cout<<2<<endl;}
cout<<1<<" "<<ax-az;
return 0;
}
10.6人
JX-J00012的T4,单走一个6,没写freopen...
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
cout<<6;
return 0;
}
这是他的 T3:
#include <bits/stdc++.h>
using namespace std;
int ans;
string a;
long long ;
int main()
{
cout<<1<<endl;
cout<<3<<" "<<3;
return 0;
}
11.in main 人
#include<iostream>
using namespace std;
in main(){
freopen("pow.in""r",stdin);
freopen("pow.out""w",stdout);
int a,b,sum=1;
cin>>a>>b;
for(int i=0;i<=b;i++){
sum=sum*a;
i++;
}
for(int i=0;i<=b;i++){
if(sum<1000000000)cout<<sum<<endl;
else return -1;
}
return 0;
}
12.freopen 垫底人
JX-J00014的每道题,都...
#include<bits/stdc++.h>
using namespace std;
struct jm{
int n,e,d,p,q;
}a[100005];
int main()
{
int k;
cin>>k;
for(int i=0;i<k;i++){
cin>>a[i].n>>a[i].e>>a[i].d;
}
for(int i=0;i<k;i++){
}
for(int i=0;i<k;i++){
if(a[i].p<a[i].q){
cout<<a[i].p<<" "<<a[i].q<<endl;
}
else{
cout<<a[i].q<<" "<<a[i].p<<endl;
}
}
freopen("decode.in","r",stdin);
freopen("decode.out","w",stdout);
return 0;
}
13.写了freopen但是仍然爆零人
JX-J00016每题都写了freopen
freopen("decode","in","r","stdin");
freopen("decode","out","w","stdout");
14.ccf lover
/*
CCF I love you!!!
*/
//love CCF
15.打表打错人
#include <bits/stdc++.h>
using namespace std;
int main(){
freopen("expr.in","r",stdin);
freopen("expr.out","w",stdout);
long long n;
cin>>n;
if (n=0&(1|0)|(1|1|1&0)){
cout<<n<<endl<<"1 2";
}
if (n=(0|1&0|1|1|(1|1))&(0&1&(1|0)|0|1|0)&0){
cout<<n<<endl<<"2 3";
}
if (n=(0|1&0|1|1|(1|1))&(0&1&(1|0)|0|1|0)&0){
cout<<n<<endl<<"2 3";
}
else{
cout<<"0"<<endl<<"13574 23148";
}
return 0;
}
16.又是freopen
freopen("decode.cpp",r,"decode.in");
freopen("decode.cpp",w,"decode.out");
17.表白人
JX-J00026和JX-J00027两人,代码的注释中都出现了...
然而这两位考生,一个初三,一个初二...
JX-J00026:
//cout << "My dear xkx I love you!!!" << endl;
JX-J00027:
//I love Juliet for ever.
18.a^b人
JX-J00028的T1使用了^计算乘方,不知是在写c++还是excel:
#include<iostream>
using namespace std;
int main(){
freopen("pow.in","w"stdin)
freopen("pow.out","r"stdout)
long long a,b;
long long n;
cin>>a>>b;
n=a^b;
while(n<1000000000){
cout<<n;
if(n>1000000000)
cout<<"-1";
return 0;
}
}
另外,此人的T2,T3,T4提交了相同的代码
#include<iostream>
using namespace std;
int main(){
freopen("decode.in","w"stdin)
freopen("decode.out","r"stdout)
return 0;
19.二分人
JX-J00029使用二分解决数学题T2:
while(l<=r){
ull p=(l+r)/2;
if(p*(n-m+2-p)>n)r=p-1;
else if(p*(n-m+2-p)==n&&n%p==0){
cout<<min(p,n/p)<<" "<<max(p,n/p)<<endl;
b=0;
break;
}
else l=p+1;
}
20.长注释人
JX-J00030的T3有一个长长的注释,和一段打表代码
/*
#include<bits/stdc++.h>
using namespace std;
struct lian{
int next,last,val;
};
string s;
int ans,nex;
bool dfs(int p) {
vector<lian> v;
for(int i=p;i<s.length()&&s[i]!=')';i++) {
if(s[i]==')') {
nex=i+1;
for(int i=1;i<v.size();++i) {
if(v[i].val==2) {
v[i].val=v[v[i].last].val|v[v[i].next].val;
v[v[i].last].val=-1;
v[v[i].next].val=-1;
v[i].last=v[v[i].last].last;
v[i].next=v[v[i].next].next;
v[v[i].last].next=v[i].next;
v[v[i].next].last=v[i].last;
}
}
for(int i=1;i<v.size();++i) {
if(v[i].val==3) {
v[i].val=v[v[i].last].val&v[v[i].next].val;
v[v[i].last].val=-1;
v[v[i].next].val=-1;
v[i].last=v[v[i].last].last;
v[i].next=v[v[i].next].next;
v[v[i].last].next=v[i].next;
v[v[i].next].last=v[i].last;
}
}
for(int i=1;i<v.size();++i) {
if(v[i].val>-1) {
return v[i].val;
}
}
}
if(s[i]=='0') v.push_back({i-1,0,i+1});
else if(s[i]=='1') v.push_back({i-1,1,i+1});
else if(s[i]=='|') v.push_back({i-1,2,i+1});
else if(s[i]=='&') v.push_back({i-1,3,i+1});
else if(s[i]=='(') {
v.push_back({i-1,dfs(i+1),i+1});
i=nex;
}
}
}
int main() {
cin >> s;
cout << dfs(0) << endl;
return 0;
}
*/
#include<iostream>
using namespace std;
string s;
int main() {
freopen("expr.in","r",stdin);
freopen("expr.out","w",stdout);
cin >> s;
if(s.length()<=3) {
if(s=="1|1" || s=="1|0") {
cout << 1 << endl;
cout << 0 << ' ' << 1;
}else if(s=="0|1") {
cout << 1 << endl;
cout << 0 << ' ' << 0;
}else if(s=="0|0") {
cout << 0 << endl;
cout << 0 << ' ' << 0;
}else if(s=="1&1") {
cout << 1 << endl;
cout << 0 << ' ' << 0;
}else if(s=="0|1" || s=="0|0") {
cout << 0 << endl;
cout << 0 << ' ' << 1;
}else if(s=="1&0") {
cout << 0 << endl;
cout << 0 << ' ' << 0;
}
}else {
cout << 1 << endl;
cout << 1 << ' ' << 1;
}
fclose(stdin);
fclose(stdout);
return 0;
}
另外,此人的T1题最后有一段长长的注释
/*
I'm TLEWA!!!(Yu Zhou She Xian Jiao Jiao Zhu)
I AK IOI!!!
Bie Xue Shu,Yao Mo Zheng!!!
Yu zhou she xian wan sui!!!
8:30 chuguo le
8:35 Yu Zhou She Xian NB!!! 2021 csp...
8:40 Wo Jue Ding le,Yao Ya Hang
8:42 404
9:01 AT1
9:25 AT2
9:38 T3emmm...kan T4
11:18 bailan
11:35 T4 AC
12:00 T3 dog is not xie
*/
21.爆零人
JX-J00031的每题都没写freopen,在此点名表扬
22.dp人
//ccf ni kao zhe wan yi?wo fu xi le yi zhou DP ni yi ti dou bu kao?
23.wryyy
//wryyy think this problem is also /\ hard
//wryyy's horse bee is very ugly
//wryyy don't like zifuchuan and moni
//wryyy d i e
//the competition begin so slow
//why! why don't let me begin the test!
//wryyy from luogu planet is sad because he have so many competitors
//but wryyy will ... will... will beat them down!
//wryyy is cxk's saikuo
24.万能头人
JX-J00101和JX-J00229的万能头,分别叫 <bits/stdc++> 和 <bits/stdc++>h>
25.??? 人
JX-J00248的T4只有3行,但是
#include <fstream>
#include <memory>
inline int* __(void* pt,register uint_least16_t* ptm,uint64_t*** ptg){*ptm=0x57;delete ptg;return nullptr;}int main(){std::wifstream input{};input.open("point.in");std::wofstream output{};output.open("point.out");for(;;)delete[] __(nullptr,nullptr,nullptr);}
26.基督教信徒
JX-J00279的每题中注释都有
//pu sa bao you
//yi xing geng dang zou shi ye yong li xiang
//shang di bao you wo
//
// ..
// ..
// ..
// ..
// ..
// ..
// .......................
// .......................
// ..
// ..
// ..
// ..
// ..
// ..
// ..
// ..
27.小黑子
int cxk;
cxk=0;
cxk=1;
...