多项式滚出OI【模拟】

  • Post author:
  • Post category:其他



>Link





luogu T202675




>Description

把数



f

(

m

)

f(m)






f


(


m


)





转化成



m

m






m





进制数




m

,

f

(

m

)

1

0

18

m,f(m)\le10^{18}






m


,




f


(


m


)













1



0











1


8














>解题思路

实际上就是个大水题QwQ,但是不知道为啥有一个点RE了然后才60分

后来看了下别人的代码修改了一下存答案的方式就A了



>代码

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define LL long long
#define N 10000010
using namespace std;

int n;
LL m, f, a, ans[N];

int main()
{
	scanf ("%lld%lld", &m, &f);
	while (f)
	{
		ans[++n] = f % m;
		f /= m;
	}
	printf ("%d\n", n);
	for (int i = 1; i <= n; i++)
	  printf ("%lld ", ans[i]);
	return 0;
}



版权声明:本文为qq_43010386原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。