当前位置:网站首页>[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;
}
边栏推荐
- Common source code for ArcGIS development
- Gan, why '𠮷 𠮷'.Length== 3 ??
- Formal parameters, arguments and return values in functions
- XSS collect common code
- 3day
- Perform Jieba word segmentation on the required content and output EXCEL documents according to word frequency
- Xiaobai programmer day 8
- Which is reliable between qiniu business school and WeiMiao business school? Is it safe to open an account recommended by the teacher?
- 4day
- Some summary about function
猜你喜欢
![[PMP learning notes] Chapter 1 Introduction to PMP System](/img/80/144124af40f0a015c4deafc3aa7432.png)
[PMP learning notes] Chapter 1 Introduction to PMP System

(1) Integrating two mapping frameworks of Dao

C语言逆序打印字符串的两种方法

Get together for ten years, tell your story, millions of gifts are waiting for you

The price of dividing gold bars

Ffmpeg plays audio and video, time_ Base solves the problem of audio synchronization and SDL renders the picture

xxl-job中 关于所有日志系统的源码的解读(一行一行源码解读)

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

Xiaobai programmer's sixth day

Tfrecord write and read
随机推荐
xss-收集常用的代码
(1) Integrating two mapping frameworks of Dao
Usage of in in SQL DQL query
Tfrecord write and read
ML-Numpy
H5幸运刮刮乐抽奖 免公众号+直运营
科大讯飞智能办公本Air电纸书阅读器,让我的工作生活更加健康
vim用法记录
Formal parameters, arguments and return values in functions
[PMP learning notes] Chapter 1 Introduction to PMP System
arcgis开发常用源码
Interpretation of the source code of all logging systems in XXL job (line by line source code interpretation)
PySpark数据分析基础:pyspark.sql.SparkSession类方法详解及操作+代码展示
Method of converting MAPGIS format to ArcGIS
Perform Jieba word segmentation on the required content and output EXCEL documents according to word frequency
scrapy无缝对接布隆过滤器
Use of hyperlinks
3 词法分析
Xiaobai programmer's first day
Mitsubishi FX PLC free port RS command realizes Modbus Communication