当前位置:网站首页>[training Day12] x equation [high precision] [mathematics]
[training Day12] x equation [high precision] [mathematics]
2022-07-25 22:30:00 【VL——MOESR】

Ideas :
We calculate directly g(x), Then I found that it was a combination of Mathematics
Remember to be highly refined
c o d e code code
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
ll n, k;
ll a[10001];
ll qpow(ll x, ll k, ll mod) {
ll ans = 1;
for(; k; k >>= 1, x = x * x % mod) if(k & 1) ans = ans * x % mod;
return ans;
}
void cheng(ll x) {
ll g = 0;
for(ll i = 10000; i >= 1; i --) {
a[i] = a[i] * x + g;
g = a[i] / 10;
a[i] %= 10;
}
}
void chu(ll x) {
ll g = 0;
for(ll i = 1; i <= 10000; i ++) {
ll p = (g * 10 + a[i]) % x;
a[i] = (g * 10 + a[i]) / x;
g = p;
}
}
// n! / m!(n-m)!
void C(ll n, ll m) {
a[10000] = 1;
for(ll i = m + 1; i <= n; i ++) cheng(i);
for(ll i = 2; i <= n - m; i ++) chu(i);
}
void write_() {
ll i = 1;
while(a[i] == 0 && i + 1 <= 10000) i ++;
while(i <= 10000) printf("%lld", a[i]), i ++;
}
int main() {
scanf("%lld%lld", &k, &n);
ll m = qpow(n, n, 1000);
C(m - 1, k - 1);
write_();
return 0;
}
边栏推荐
- ThreadLocal summary (to be continued)
- 【集训DAY13】Backpack【动态规划】【贪心】
- LabVIEW develops PCI-1680U dual port can card
- IPv4地址已经完全耗尽,互联网还能正常运转,NAT是最大功臣!
- Using simple scripts to process data in 3dslicer
- torchvision
- Interpretation of the source code of all logging systems in XXL job (line by line source code interpretation)
- 【集训DAY15】好名字【hash】
- Xiaobai programmer's sixth day
- 【集训DAY12】X equation 【高精度】【数学】
猜你喜欢

About vscode usage+ Solutions to the problem of tab failure

xss-工具-Beef-Xss安装以及使用

H5 lucky scratch lottery free official account + direct operation

【C语法】void*浅说

IFLYTEK smart office book air e-book reader makes my work life healthier

Google analyzes how UA can be transferred to the latest version of GA4

Builder pattern

Xiaobai programmer's seventh day

Data quality: the core of data governance

2day
随机推荐
Which is reliable between qiniu business school and WeiMiao business school? Is it safe to open an account recommended by the teacher?
关于getchar和scanf的使用示例及注意点
Share two music playing addresses
About vscode usage+ Solutions to the problem of tab failure
xxl-job中 关于所有日志系统的源码的解读(一行一行源码解读)
IPv4 addresses have been completely exhausted, and the Internet can work normally. NAT is the greatest contributor!
xss-工具-Beef-Xss安装以及使用
Pyspark data analysis basis: pyspark.sql.sparksession class method explanation and operation + code display
What is the difference between minor GC and full GC?
【集训DAY11】Calc【数学】
【集训DAY12】X equation 【高精度】【数学】
ThreadLocal 总结(未完待续)
Selenium basic use and use selenium to capture the recruitment information of a website (continuously updating)
Gan, why '𠮷 𠮷'.Length== 3 ??
[PMP learning notes] Chapter 1 Introduction to PMP System
If it is modified according to the name of the framework module
(1) DDL, DML, DQL, DCL and common data types
Google analyzes how UA can be transferred to the latest version of GA4
3dslicer introduction and installation tutorial
点亮字符串中所有需要点亮的位置,至少需要点几盏灯