<>A topic . space

It's very boring , The game is a game int Xingdang 4bit It's over , In fact, it is 4 byte (B)

answer :67108864
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> using namespace std; int
main() { long long int m=256; m=m*1024*1024/4; printf("%lld",m); return 0; }
<>B topic . card

The violence is over !!! But make sure you get the numbers together 1 Time , that 1 Yes

answer :3181
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> using namespace std; int
f[15]; int main() { for(int i=0;i<10;i++) f[i]=2021; int x=0,flag=1; while(1) {
int k=x+1; while(k) { int s=k%10; if(f[s]) { f[s]--; k/=10; } else { flag=0;
break; } } if(flag) x++; else break; } printf("%d",x); return 0; }
<>C. straight line

Use set to duplicate , Pass in the slope and intercept of the current line to the set each time .

* notes : When the slope does not exist , That is, the line is parallel to the y axis , Special treatment , Here the slope is expressed as infinity , Intercept acquisition x coordinate .

answer :48953
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> #include <set> using
namespace std; #define inf 0x3f3f3f3f int main() { double i,j,k,o; set<pair<
double,double> > s; for(i=0;i<20;i++) { for(j=0;j<21;j++) { for(k=0;k<20;k++) {
for(o=0;o<21;o++) { double fz=o-j; double fm=k-i; if(fm==0) s.insert(make_pair(
inf,i)); else { double x=fz*1.0/fm; double b=j-x*i; s.insert(make_pair(x,b)); }
} } } } printf("%d",s.size()); return 0; }
<>D. Goods placement

If you go directly to the third floor for loop , It must be a long time , So you can find it first n=2021041820210418 All factors of , And then we're looking for violence .

answer :2430
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> #include <set> using
namespace std; long long int a[1000000]; int main() { long long int n=
2021041820210418,i,j,k,l=0; set<pair<long long int,long long int> > s; for(i=1;i
<=sqrt(n);i++) if(n%i==0) a[l++]=i; k=l; for(i=0;i<k;i++) a[l++]=n/a[i]; for(i=0
;i<l;i++) { for(j=0;j<l;j++) { for(k=0;k<l;k++) { if(a[i]*a[j]*a[k]==n) { s.
insert(make_pair(a[i],a[j])); } } } } printf("%lld",s.size()); return 0; }
<>E. route

Create distance first , Then the shortest path algorithm is used , result … I feel wrong when I listen to others ┭┮﹏┭┮…( I hope you can correct me )

answer :804804086
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> #include <set> using
namespace std; int n,dis[2050][2050],flag[2050],d[2050]; void djiesitela(int v)
{ long long int sum=0; for(int i=1;i<=n;i++) { d[i]=dis[v][i]; } flag[v]=1; for(
int i=1;i<n;i++) { int pos,minn=INT_MAX; for(int j=1;j<=n;j++) { if(minn>d[j]&&!
flag[j]) { pos=j; minn=d[j]; } } flag[pos]=1; sum+=minn; for(int j=1;j<=n;j++) {
if(dis[pos][j]<d[j]&&!flag[j]) d[j]=dis[pos][j]; } } printf("%lld",sum); } int
main() { int i,j; n=2021; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { if(i==j) dis[i
][j]=0; else dis[i][j]=INT_MAX; } } for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { if(i
==j) continue; if(abs(i-j)<=21) { dis[i][j]=dis[j][i]=i*j/__gcd(i,j); } } }
djiesitela(1); return 0; }
<>F. Time display

In fact, date has no effect on time display , Just need to know 1s=1000ms, And then turn milliseconds into seconds , Finally, the time, minute and second are determined by the remainder .
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> #include <set> using
namespace std; int y,m,d,h,f,mi; int main() { long long int n; scanf("%lld",&n);
y=1970,m=1,d=1,h=0,f=0,mi=0; n/=1000; int S,F,M; mi=n%60; n-=mi; n/=60; f=n%60;
n/=60; h=n%24; printf("%02d:%02d:%02d",h,f,mi); return 0; }
<>G. Weighing with weights

By joining the queue , It should be noted that the weight can be added and subtracted , The added and subtracted weight is equivalent to a new weight added to the queue .
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> #include <queue> using
namespace std; int flag[100010]; int main() { int n,w[150],i,j,x,sum=0; scanf(
"%d",&n); queue<pair<int,int> > q; for(i=0;i<n;i++) { scanf("%d",&w[i]); q.push(
make_pair(w[i],i)); } while(!q.empty()) { int z=q.front().first; int ii=q.front(
).second; if(!flag[z]) { flag[z]=1; sum++; } q.pop(); for(int i=ii+1;i<n;i++) {
x=abs(w[i]-z); if(!flag[x]) { sum++; flag[x]=1; } q.push(make_pair(x,i)); } for(
int i=ii+1;i<n;i++) { x=z+w[i]; if(!flag[x]) { sum++; flag[x]=1; } q.push(
make_pair(x,i)); } } printf("%d",sum); return 0; }
<>H. Yanghui triangle

To be honest, it's a real dog , I can't deduce the law , notice 10^9 Order of magnitude , I knew that , front 20% bar , Only violence !!!o( ̄︶ ̄)o
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> #include <queue> using
namespace std; int a[10000][10000]; int main() { int n,i,j,s,flag=1; scanf("%d",
&n); if(n==1) printf("1"); else { a[0][0]=1; a[1][0]=1; a[1][1]=1; s=3; for(i=2;
;i++) { for(j=0;j<=i;j++) { if(j==0||j==i) { a[i][j]=1; s++; } else { a[i][j]=a[
i-1][j-1]+a[i-1][j]; s++; if(a[i][j]==n) { printf("%d",s); flag=0; break; } } }
if(!flag) break; } } return 0; }
<>I. Two way sorting

The mentality ahead has exploded , There's not enough time , Just use the most direct method ,sort Sort it out !!w(゚Д゚)w What's more, I'll be happy for myself .
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #
include <string> #include <cmath> #include <algorithm> #include <queue> using
namespace std; bool cmp(int a,int b) { return a>b; } int main() { int s[100005],
n,m,a,b,i; scanf("%d%d",&n,&m); for(i=0;i<n;i++) s[i]=i+1; for(i=0;i<m;i++) {
scanf("%d%d",&a,&b); if(a==0) sort(s,s+b,cmp); else sort(s+b-1,s+n); } for(i=0;i
<n;i++) { printf("%d",s[i]); if(i!=n-1) printf(" "); } return 0; }
<>J. Bracket sequence

After writing the code, my own example overthrows me (⊙o⊙)… It's really amazing !!

<> If there is any deficiency , I hope you can correct me in the comments section ,Thanks♪(・ω・)ノ

Technology