## Simulation test summary

### T1 small R and triangle

There are n villages in the small town where Xiao R is located. These n villages are distributed on a circle. One of these villages is

There are direct paths between two. The paths may intersect, but there are no three roads at one point. Now little R is just right

It's summer vacation. I wander among the villages every day. One day, he found that he could start from a non village point

Without going through the village, go through three paths and then return to this point. So he wondered how many there were

What about such a circuit

### Problem solving ideas

Simply push it to know that as long as you choose 6 points from n points, you will be able to form different triangles

So the answer is
C
n
6
C_n^6
Cn6, A dropped in ten minutes

#include<bits/stdc++.h> using namespace std; const int N = 110; long long C[N][N]; void init(int n) { for(int i=0;i<=n;i++) C[i][0]=1; for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { C[i][j]=C[i-1][j-1]+C[i-1][j]; } } } int main() { freopen("triangle.in","r",stdin); freopen("triangle.out","w",stdout); int n; cin>>n; init(n); cout<<C[n][6]<<endl; return 0; }

### T2 small R and coin

Xiao R was very busy in summer vacation. He came to Mars one day, and he had habit of collecting coins. So he sent Mars

All the coins on the have been collected, a total of n: the denominations are a1,a2... an. Small R in machine

I saw a favorite gift and wanted to buy it for Xiao L. the price of this gift is X yuan. Small R

I want to know which coins must be used in order to buy this gift, that is, little R must give up collecting

What kind of coins do you have. The airport does not provide change and only accepts exactly X Yuan

### Problem solving ideas

Originally, I only wanted to write 40 points, but the data water turned into 60 points,

That is to enumerate whether each number can be unchecked, and then do backpacking

#include<bits/stdc++.h> using namespace std; typedef long long LL; LL f[20020]; int n,x; int a[1000020]; int vis[120020]; int top=0,ans[120000]; bool cmp(int x,int y) { return x<y; } int main() { freopen("coin.in","r",stdin); freopen("coin.out","w",stdout); scanf("%d%d",&n,&x); for(int i=1;i<=n;i++) scanf("%d",&a[i]); sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++) { f[0]=1; for(int k=1;k<=x;k++) f[k]=0; for(int j=1;j<=n;j++) { if(j==i) continue; for(int k=x;k>=a[j];k--) f[k]+=f[k-a[j]]; } if(f[x]==0&&vis[a[i]]==0) { vis[a[i]]=1; ans[++top]=a[i]; } } printf("%d\n",top); for(int i=1;i<=top;i++) printf("%d ",ans[i]); return 0; }

#### Positive solution

Fill in:

### T3 small R and home

Little R is tired of playing on Mars and plans to go home. This is a story of time and space travel.

Little R will return to earth (n) from Mars (No. 1). There are n planets in the universe,

There are some routes between planets, but some routes between planets may lead to time reversal, and between planets

The route is not guaranteed to be reversible (i.e. the time from a to b and the time from b to a are not necessarily the same). Space time travel

It is required not to arrive at the final destination before the departure time, otherwise it will lead to space-time disorder and life-threatening.

The small R spacecraft has a speed adjustment device, which can be used to change the flight time between planets, that is, it can

The time between two planets increases or decreases by the same integer in the whole time-space journey. Little R is very homesick. Can you

Help him find the quickest way home

### Problem solving ideas

No, I wrote a 20 point special case and hung up

No more code

### T4 small R and module division

Modular division, a binary operation that is not commutative, can be written. Sometimes it is also called. This operation means finding the remainder of the division of two numbers, also known as the remainder operation. It is expressed by "%" in language.

Small constructs an array with a length of n and the element of (the subscript of array A is calculated from). For example, at that time, now we need to perform group query, and each query is given two parameters. Ask. For each query, tell the small to the maximum value of the array elements in.

#### Problem solving ideas:

40% can be preprocessed with st table

Then a rule was introduced during the exam, but the array was smaller, only 40pts

But only 70pts after opening, unexplained WA

#include<bits/stdc++.h> using namespace std; typedef long long LL; const LL LN=1e5+500; LL n,m; LL st[LN][22]; void prework(LL n) { for(LL i=1;i<=n;i++) st[i][0]=(n%i); LL t=log(n)/log(2)+1; for(LL j=1;j<t;j++) for(LL i=1;i<=n-(1<<j)+1;i++) st[i][j]=max(st[i][j-1],st[i+(1<<(j-1))][j-1]); } LL query(LL l,LL r) { LL t=log(r-l+1)/log(2); return max(st[l][t],st[r-(1<<t)+1][t]); } LL get_range(LL x) { LL l=2,r=n+1,mid,ans=-1; while(l<=r) { LL mid=(l+r)>>1; if(n/mid+1<=x) { ans=mid; r=mid-1; } else l=mid+1; } return ans; } int main() { freopen("Modulus.in","r",stdin); freopen("Modulus.out","w",stdout); scanf("%lld%lld",&n,&m); if(n<=1e5) { prework(n); while(m--) { LL l,r; scanf("%lld%lld",&l,&r); printf("%lld\n",query(l,r)); } } else { prework(100050); while(m--) { LL l,r; scanf("%lld%lld",&l,&r); if(l==r) { printf("%lld\n",(n%l)); continue; } if(r<=1e5) { printf("%lld\n",query(l,r)); continue; } LL posl=get_range(l); LL posr=get_range(r); if(posl==posr) { printf("%lld\n",n%l); continue; } else { printf("%lld\n",max(n%l,n%(n/posr+1))); continue; } } } return 0; }

### summary

Basically gave everything they could, but they weren't careful enough

## Summary of fifteen day training

1: I learned a lot of knowledge and brushed a lot of questions. Although mathematics was quite autistic in the last four days, I gained a lot on the whole

2: Although the test results are not satisfactory, it also adds test experience

3: I also made some new friends and realized how terrible the big guys are

4: Had a pleasant 15 days