好吧已经过晕了……
上午由于讲座,因此没有题目。
但是晚上有另一套题……
让我们开始吧。
CF1916
[A]
水。
直接暴力除法后输出 k-1 个 1 与得到的结果。
[B]
直接求出 lcm(a,b) 后判断是否等于 b。
如果是,那么答案再乘上 \frac{b}{a}
[C]
忘了开 long long
然后吃罚时。
显然只有奇数+偶数的时候答案才会缩小。
而因为奇数+奇数=偶数,因此先手的操作肯定是每次都取出两个奇数进行相加。
而后手则是在奇数和偶数中各选择一个进行相加。
因此每一次损失是 s1/3+[s1 \mod 3=1],其中 s1 是奇数个数。
[D]
什么天赋题。
注意到 n 是一个奇数,因此每一步答案可以在 n-2 上加两个0构成。
打表发现 n=11 时,有一组是满足个数=143的。
我们将这一组存下来,对于 n>11 的情况,在每一个答案后面加对应的0的个数即可。
而对于 n<11 的情况,对 n=1,3,5,7,9 分别打表。
打表程序如下:
#include<bits/stdc++.h>
using namespace std;
const int N=1e3;
typedef long long LL;
map<multiset<int>,LL>mp;
LL cnt=0,res=0;
int main()
{
freopen("asdf.txt","w",stdout);
for(LL i=10000;i<=31622;i++)
{
multiset<int>S;
LL p=i*i;
while(p)
{
S.insert(p%10);
p/=10;
}
mp[S]++;
res=max(res,mp[S]);
}
printf("%lld\n",res);
for(LL i=10000;i<=31622;i++)
{
multiset<int>S;
LL p=i*i,st=i*i;
while(p)
{
S.insert(p%10);
p/=10;
}
if(mp[S]==res)printf("%lld ",st);
}
return 0;
}
主程序如下:
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n;
typedef long long LL;
string str[150]={"10057482369","10208475369","10859307264","12938607504","13470852096","13985427600","14050783296","14809673025","15284376900","15309607824","15732684900","16203507849","16375809024","17049830625","17206093584","17345680209","17530289604","17689532004","18497360025","20134758609","20635897104","20851937604","20859736041","20897015364","21538497600","21753890064","23054170896","23081509476","24589376100","25083907641","25481736900","25713084609","25874009316","25930016784","25936780401","26913058704","27003691584","27058934016","27905368401","28391576004","28403709156","29754180036","30264517089","30410825769","30829741056","30902475681","31807652409","32059618704","32659718400","34900217856","35042716809","35047209681","35249687001","35600897124","35907218064","36108740529","36187452900","36805271409","37018529604","37019684025","37546812900","37984061025","38294576100","38417960025","38529764100","39207564081","40053217689","40305782169","40935810276","41273985600","41602537089","41753200896","43678910025","45038601729","45090823716","45231080976","45390728601","48621573009","48702310596","49370618025","50201987364","50704681329","51072836049","52381476900","52908740361","52987436100","53721968400","53968400721","54800937216","54807960321","54938672100","57408639201","58743216900","58932417600","59608734201","59736248100","60054893721","61538724900","62017435089","62795348100","64592730801","65392718400","65701480329","67105348209","67293548100","67520983104","68750413209","68915700324","69743528100","69827534001","70651234809","70849130625","71465328900","71503829604","73086419025","73206501489","73598264100","74380016529","74381652900","74980130625","76132950084","76841503209","78391040256","79634018025","80431796025","80907251364","82109756304","82304150769","82369574001","82971650304","84050127396","84297315600","84715923600","85046307129","85207361409","86540107329","87430210596","87526039104","89147030625","90387416025","92318745600","98306704521","98310467025"};
void work()
{
scanf("%d",&n);
if(n==1)
{
puts("1");
return;
}
if(n==3)
{
printf("169\n196\n961\n");
return;
}
if(n==5)
{
printf("16384\n31684\n36481\n38416\n43681\n");
return;
}
if(n==7)
{
printf("1006009\n1060900\n1690000\n1960000\n6100900\n9006001\n9060100\n");
return;
}
if(n==9)
{
printf("139854276\n152843769\n157326849\n215384976\n245893761\n254817369\n326597184\n361874529\n375468129\n");
return;
}
for(int i=1;i<=n;i++)
{
cout<<str[i];
for(int j=11;j<n;j++)printf("0");
puts("");
}
}
int main()
{
int T;
scanf("%d",&T);
while(T--)work();
return 0;
}