Title Link: https://nanti.jisuanke.com/t/27644
Main topic:
Problem Solving Ideas:
Code:
1#include <bits/stdc++.h>2 #defineLC (a) (a<<1)3 #defineRC (A) (a<<1|1)4 #defineMID (A, B) ((A+B) >>1)5 #defineFin (name) freopen (name, "R", stdin)6 #defineFout (name) freopen (name, "W", stdout)7 #defineCLR (arr,val) memset (arr,val,sizeof (arr))8 #define_for (i,start,end) for (int i=start;i<=end;i++)9 #defineFast_io Ios::sync_with_stdio (false); Cin.tie (0);Ten using namespacestd; OnetypedefLong LongLL; A Const intn=1e5+5; - Const intinf=0x3f3f3f3f; - Const Doubleeps=1e-Ten; the - structnode{ - intb; - }p[n]; + - BOOLCMP (node X,node y) { + returnx.a*y.b+x.b>y.a*x.b+y.b; A } at - intMain () { - Fast_io; - intT; -Cin>>T; - while(t--){ in intn,x; -Cin>>n>>x; to for(intI=1; i<=n;i++){ +Cin>>p[i].a; - } the for(intI=1; i<=n;i++){ *Cin>>p[i].b; $ }Panax NotoginsengSort (p+1, p+1+n,cmp); - intans=0, tmp=1; the for(intI=1; i<=n;i++){ +ans= (ans+tmp*p[i].b)%Ten; Atmp=tmp*p[i].a%Ten; the } +ans= (ans+tmp*x)%Ten; -cout<<ans<<Endl; $ } $ return 0; -}
The most value of the room function of the shell of garlic (good question, clever sort)