NOIP2021 LN代码迷惑行为大赏
本集锦中保证不出现考生准考证号等透露个人信息的内容.
LN 由于突发的疫情原因,不同地区考生在不同考点进行考试,本集锦仅统计DL地区.
A+B problem 人
int a,b;
int main()
{
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
a=read(),b=read();
cout<<a+b<<"\n";
back 0;
}
Hello,world 人
#include<bits/stdc++.h>
using namespace std;
int main()
{
printf("hello world!");
return 0;
}
打 表 人
#include<cstdio>
#include<algorithm>
#define IO(x) freopen(x ".in","r",stdin),freopen(x ".out","w",stdout)
int ans[]={1,2,3,4,5,6,8,9,10,...}// 此处省略
int n,x,bi;
int main()
{
IO("number");
scanf("%d",&n);
while(n--)
{
scanf("%d",&x);
bi=std::upper_bound(ans,ans+29140,x)-ans;
//printf("ce : %d %d %d\n",bi,ans[bi],ans[bi-1]);
if(bi==0||ans[bi-1]!=x)
{
printf("-1\n");
continue;
}
printf("%d\n",ans[bi]);
}
return 0;
}
代码大小 182kb.
声明 ans
数组这一行 列数为 185207.
int a[200006];
int b[200006]={
1,2,3,4,5,6,8,-1,9,10,11,12,13,15,-1,16,18,-1// 此处省略
int main(){
freopen("number.in","r",sidin);
freopen("number.out","w",stdout);
t=read();
for(int i=0;i<=t;i++){
a[i]=read();
printf("%d\n",b[a[i]]);
}
return 0;
}
代码大小 35kb
声明 b
数组这一行 列数为 34527
int ans[]={0,0,0,0,0,0,// 此处省略
int main(){
freopen("number.in","r",stdin);
freopen("number.out","w",stdout);
int t=read();
while(t--){
int x=read();
if(ans[x]==1){printf("-1\n");continue;}
else{
for(int i=x+1;;++i){
if(ans[i]==0){printf("%d\n",i);break;}
}
}
}
return 0;
}
代码大小 392kb
声明 ans
数组这一行 列数为 400035
快 读 人
#1
inline int read_int(){
int x = 0,f = 1;
char c = getchar();
while(c < '0' || c > '9'){
if(c == '-') f = -1;
c = getchar();
}
while(c >= '0' && c <= '9'){
x = (x << 3) + (x << 1) + (c ^ 48);
c = getchar();
}
return x * f;
}
inline long long read_long(){
long long x = 0,f = 1;
char c = getchar();
while(c < '0' || c > '9'){
if(c == '-') f = -1;
c = getchar();
}
while(c >= '0' && c <= '9'){
x = (x << 3) + (x << 1) + (c ^ 48);
c = getchar();
}
return x * f;
}
#2
#include <bits/stdc++.h>
using namespace std;
int read()
{
int x = 0,f = 1;
char ch = getchar();
while(ch < '0'||ch > '9')
{
if(ch == '-') f = -1;
ch = getchar();
}
while(ch >= '0'&&ch <= '9')
{
x = x * 10 + ch - '0';
ch = getchar();
}
return x*f;
}
// 以上为 'chess.cpp' 的全部内容
自 信 随 机 人
#1
int main()
{
IO("sequence");
srand(time(NULL));
printf("%d",rand()%998244353);
return 0;
}
#2
int main(){
freopen("sequence.in","r",stdin);
freopen("sequence.out","w",stdout);
scanf("%d%d%d",&n,&m,&k);
for(register int i(1) ; i<=m+1 ; i=-~i){
scanf("%d",&v[i]);
}
srand(time(0));
printf("%d\n",rand()%1049);
return 0;
}
#3
int main()
{
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
srand(time(0));
scanf("%d",&t);
while(t--){
int n,m,q;
scanf("%d %d %d",&n,&m,&q);
for(int i=1;i<=n;i++)
{
cin>>a;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=4;j++)
{
scanf("%d",&k);
}
}
for(int i=1;i<=n;i++)
{
printf("%d\n",rand()%5);
}
}
return 0;
}
自 信 固 输 人
#1
signed main()
{
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
int T = read();
while(T--)
{
write(0),putchar('\n');
}
return 0;
}
#2
int main(){
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
int t;
scanf("%d",&t);
while(t--){
int n,m,q;
scanf("%d%d%d",&n,&m,&q);
for(register int i(1) ; i<=q ; i=-~i){
cout << 1 << endl;
}
}
return 0;
}
#3
ll ans;
int v[N],a[N],temp[N];
int main(){
freopen("sequence.in","r",stdin);
freopen("sequence.out","w",stdout);
n=read(),m=read(),k=read();
fn(i,0,m)v[i]=read();
printf("%d\n",ans);
return 0;
}
#4
int main(){
freopen("sequence.in","r",stdin);
freopen("sequence.out","w",stdout);
scanf("%d %d %d\n",&n,&m,&k);
for (int i=1; i<=m+1; i++){
scanf("%d ",&v[i]);
}
printf("400");
return 0;
}
自 信 样 例 人
#1
int main()
{
freopen("chess.in", "r", stdin);
freopen("chess.out", "w", stdout);
int t;
scanf("%d", &t);
while(t--)
{
scanf("%d%d%d", &n, &m, &q);
if(n == 3 && m == 3 && q == 5)
printf("4\n3\n3\n3\n2\n");
if(n == 2 && m == 3 && q == 4)
printf("3\n4\n4\n2\n");
if(n == 3 && m == 2 && q == 3)
printf("5\n5\n1\n");
}
return 0;
}
#2
int main()
{
freopen("sequence.in", "r", stdin);
freopen("sequence.out", "w", stdout);
scanf("%d%d%d", &n, &m, &k);
if(n == 5 && m == 1 && k == 1)
printf("40");
if(n == 8 && m == 9 && k == 4)
printf("642171527");
return 0;
}
#3
int main()
{
freopen("sequence.in","r",stdin);
freopen("sequence.out","w",stdout);
n=read(),m=read(),k=read();
for(int i=1;i<=m+1;i++)
v[i]=read();
printf("0");
return 0;
}
#4
int main()
{
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
int n,x,z;
cin>>n>>x;
while(cin>>z);
if(n==1)cout<<"4\n3\n3\n3\n2";
if(n==2)cout<<"3\n4\n4\n2\n5\n5\n1";
}
头 文 件 人
# define my_file "number"
# include <bitset>
# include <chrono>
# include <cstdarg>
# include <cstddef>
# include <cstdlib>
# include <ctime>
# include <functional>
# include <initializer_list>
# include <tuple>
# include <utility>
# include <memory>
# include <new>
# include <cfloat>
# include <cinttypes>
# include <climits>
# include <cstdint>
# include <limits>
# include <cassert>
# include <cctype>
# include <cstring>
# include <string>
# include <array>
# include <deque>
# include <forward_list>
# include <list>
# include <map>
# include <queue>
# include <set>
# include <stack>
# include <unordered_map>
# include <unordered_set>
# include <vector>
# include <algorithm>
# include <cmath>
# include <complex>
# include <random>
# include <cstdio>
# include <fstream>
# include <iomanip>
# include <ios>
# include <iostream>
# include <sstream>
大 力 压 行 人
# include <bits/stdc++.h>
using namespace std;
const int n=1e7+10;
int t,mp[n+10],f[n+10],fcnt;
bool check_(int i) { while (i) { if (i%10==7) return true; i/=10;} return false;}
void first_init_() { for (int i=1;i<=n;i++) if (!mp[i]&&check_(i)) for (int j=1;j*i<=n;j++) mp[j*i]=1;}
void second_init_() { for (int i=1;i<=n;i++) if (!mp[i]) f[++fcnt]=i;}
int binarysearch_(int l,int r,int x) { if (l==r) return f[l]==x ? l : 0; int mid=(l+r)/2; return f[mid]<x ? binarysearch_(mid+1,r,x) : binarysearch_(l,mid,x);}
void answer_(int a,int b) { while (t--) scanf("%d",&a), b=binarysearch_(1,fcnt,a), b ? printf("%d\n",f[b+1]) : printf("-1\n");}
int main() { freopen("number.in","r",stdin), freopen("number.out","w",stdout), first_init_(), second_init_(), scanf("%d",&t), answer_(0,0); return 0;}
留 言 人
#1
int n,m,q;
// I left little time for this problem.
// So I could not get any points from BFS cause it's not completed yet.
// Never Compress Your Code !
// Never gOnna gIve you uP
unsigned short col[N][N];
unsigned short lv[N][N];
#2
void solve_spec() {
ll ans = 0;
// I don't konw how
// So this 15 pts I bai lan
write(ans),enter;
}
#3
int main(){
freopen("sequence.in","r",stdin);
freopen("sequence.out","w",stdout);
n=read(),m=read(),k=read();
for(int i=1;i<=m;i++){
a[i]=read();
sum+=a[i];
}
printf("%lld",(sum*114514)%998244353);
//md 暴力挂了
//AFO
return 0;
}
#4
int main()
{
freopen("chess.in","r",stdin);
freopen("chess.out","w",stdout);
printf("--------\n");// 此输出含有泄露选手个人信息内容,自动屏蔽
printf("再见OI");
}
#5
int n,m,k;
ll a[M],dp[2][5005*M];
int cnt[5005*M];
//Don't forget to check the size!!!
#6
main(){
freopen("chess.in","r",stdin);freopen("chess.out","w",stdout);
int tt=read();
while(tt--)solve();
return 0;
}
//Farewell,OI.
#7
main(){
freopen("variance.in","r",stdin);freopen("variance.out","w",stdout);
n=read();
fp(i,1,n)b[i]=read();
solve(0.46);solve(0.92);
printf("%lld\n",ans);
return 0;
}
//我可能看过类似的题,可惜我没记住而且还是不会做呵呵。
变 量 卖 萌 人
for(int t=1;t<=T;t++)
{
n[t]=read();
awa=max(awa,n[t]);
}
awa+=100005;
for(int i=7;i<=awa;i++)if(check[i]==0)
{
int ls=i,pd=0;
for(;ls>0;ls/=10)
{
int miao=ls%10;
if(miao==7)
{
pd=1;
break;
}
}
if(pd==1)for(int now=i;now<=awa;now+=i)check[now]=1;
}
变 量 膜 拜 人
#1
int sto[maxn];
#2
struct yjx{
int x,y,col,flag;
};
queue<yjx> Q;
关 键 词 人
static constexpr const int INF(INT_MAX);
static constexpr const int Mod(998244353);
文 明 人
int cnm(int x,int y){return abs(a[x]-a[y])*abs(a[x]-a[y]);}
ull qiba[105];
ull qusi[55];
ull jia[55]={0};
ull jiao[55];
ull ntm[55];
F C C 人
#define FCC fclose(stdin),fclose(stdout)
C E 人
#include<bits/stdc++.h>
using namespace std;\
const int M=2<<20+10;
const int MOD=998244353;
int m,n,k;
int v[50];
int f[50][M];
int ff[50][M];
其中第二行的反斜杠是选手代码原有的.
写 题 解 人
const int mod=998244353;
int v[110];
int sum[100];//存从0-k每个数字出现多少次
int sum_n=0,ans=0,n,k,m,up,down;
/*
20分:
选择i个数字,满足sigma a[i] 在3-12 且 a[i]<=k
ans+=(n,i)*v[j]^sum[j]
*/
不 假 思 索 人
int main(){
freopen("variance.in","r",stdin);
freopen("variance.out","w",stdout);
n=read();
for(int i=1;i<=n;++i){
a[i]=read();
sum+=a[i];
}
for(int i=1;i<=n;++i){
ans+=(n*a[i]-sum)*(n*a[i]-sum);
}
printf("%d\n",ans/n);
return 0;
}
完 美 缩 进 人
if(zuida<=100){
zuida=2000;
}
else{
if(zuida>100&&zuida<=1000){
zuida=20005;
}
else{
if(zuida>=10000&&zuida<=200000){
zuida=200002;
}
else{
if(zuida>200000){
zuida=10000005;
}
}
}
}
忠 实 C 语 言 人
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Consts
#define RN 500005
// Defs
typedef int I;
typedef char C;
typedef double F;
typedef long long L;
// Utility
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(T, a, b) ({T t = a; a = b; b = t;})
// Global
I map[RN][2], vi[RN], strength[RN], stkx[RN], stky[RN], color[RN];
C str[RN];
I n, m, q;
作者:AstatineAi
本文为 作者 AstatineAi 的原创,遵循CC BY-NC-SA 4.0 版权协议,转载请附上原文出处链接及本声明。