[关闭]
@2368860385 2021-09-22T09:58:00.000000Z 字数 2701 阅读 203

NOIP提高班题目汇总

coduck


1-POJ 1958 Strange Towers of Hanoi

链接

2-luogu 1226

https://www.luogu.com.cn/problem/P1226

3-nowcoder 2019河北省大学生程序设计竞赛(重现赛)b

https://ac.nowcoder.com/acm/contest/903/B

3.1题意

3.2题解

直接等比数列求和公式?p不一定微素数
分治

3.3代码

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. #define int long long
  5. inline int read() {
  6. int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
  7. for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
  8. }
  9. int ksm(int a,int b,int mod) {
  10. int ans = 1;
  11. while (b) {
  12. if (b & 1) ans = ans * a % mod;
  13. a = a * a % mod;
  14. b >>= 1;
  15. }
  16. return ans;
  17. }
  18. int solve(int n,int q,int mod) {
  19. if (n == 1) return q % mod;
  20. int tmp = solve(n / 2, q, mod);
  21. if (n % 2 == 0) {
  22. return (tmp + tmp * ksm(q, n / 2, mod)) % mod;
  23. }
  24. else {
  25. return (tmp + tmp * ksm(q, n / 2, mod) + ksm(q, n, mod)) % mod;
  26. }
  27. }
  28. signed main(){
  29. int T = read();
  30. while (T -- ) {
  31. int q = read(), n = read(), mod = read();
  32. cout << solve(n, q, mod) << "\n";
  33. }
  34. return 0;
  35. }

luogu 2044

https://www.luogu.com.cn/problem/P2044

luogu 3197

https://www.luogu.com.cn/problem/P3197

luogu 1498
https://www.luogu.com.cn/problem/P1498

P1010 [NOIP1998 普及组] 幂次方

https://www.luogu.com.cn/problem/P1010

P3612 [USACO17JAN]Secret Cow Code S

https://www.luogu.com.cn/problem/P3612

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. #define int long long
  5. inline int read() {
  6. int x=0,f=1;char ch=getchar();for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
  7. for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';return x*f;
  8. }
  9. signed main(){
  10. string s;
  11. cin >> s;
  12. int n;
  13. cin >> n;
  14. int m = s.size(), t = m;
  15. while (m <= n) m *= 2; m /= 2;
  16. while (n > t) {
  17. if (n > m) {
  18. n -= (m + 1);
  19. if (n == 0) n = m;
  20. }
  21. m /= 2;
  22. }
  23. cout << s[n - 1];
  24. return 0;
  25. }

https://www.luogu.com.cn/problem/P5657
https://www.luogu.com.cn/problem/P1228
https://www.luogu.com.cn/problem/P1115
https://www.luogu.com.cn/problem/P1177
https://www.luogu.com.cn/problem/P1908
https://www.luogu.com.cn/problem/P1309
https://www.luogu.com.cn/problem/P1177
https://www.luogu.com.cn/problem/P1923

P1429 平面最近点对(加强版)

https://www.luogu.com.cn/problem/P1429

洛谷 1608 路径统计

https://www.luogu.com.cn/problem/P1608
洛谷 1144 最短路计数

HDU 6331 Walking Plan

洛谷 2865 [USACO06NOV] 路障 & 洛谷 3953 [NOIP2017] 逛 公园
CF567E President and Roads
洛谷 6175 无向图的最小环问题
洛谷 1119 灾后重建
洛谷 5651 基础最短路练习题
CF954D Fight Against Traffic
CF1076D Edge Deletion
CF715B Complete The Graph
[SDOI2009]Elaxia 的路线
[Violet 6] 故乡的梦 b & 洛谷 2685 [TJOI2012] 桥 & CF1163F Indecisive Taxi Fee
[Usaco2009 Jan] 安全路经 Travel
POJ 2395 Out of Hay & LOJ 137 最小瓶颈路加强版
AtCoder2643 Built?
AtCoder2134 Zigzag MST
BZOJ4973 比特战争
洛谷 2619/BZOJ2654 Tree
▶ FZU2087 统计树边
▶ FZU2087 统计树边
[JSOI2008] 最小生成树计数
URAL1416 Confidential
[BJWC2010] 严格次小生成树
洛谷 5540 最小乘积生成树
洛谷 4768 [NOI2018] 归程
CF609E Minimum spanning tree for each edge
HDU4126 Genghis Khan the Conqueror
BZOJ2238 Mst
BZOJ2561 最小生成树
[SHOI2010] 最小生成树

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注