码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • SDUT 2022 summer team contest 5th(for 21)


    E - Fractions

    About 44 days are left before College Scholastic Ability Test is held. This exam aims to measure students' achievement of National Curriculum standards and scholastic ability required for college education. (http://www.kice.re.kr/sub/info.do?m=0205&s=english)

    One of the subjects covered by this test is Mathematics, which consists of 21 multiple choice questions and 9 short-answer questions. The answer of each short-answer question is guaranteed to be a unique positive integer below 1 000, as you can see from the answer sheet below.

    However, the organizers might want to give students short-answer questions with non-integer answers, such as 2\sqrt{3}23​ or \frac{5}{3}35​. Usually, the workaround is to write the answer in a canonical form, and then sum up all the integers inside that form and ask students to write that number instead.

    In particular, when the answer is a positive rational number \frac{a}{b}ba​, the organizers usually ask students to reduce it and sum up the numerator and the denominator of the reduced fraction. For example, when the answer is \frac{18}{10}1018​, the student should reduce it to \frac{9}{5}59​ and write the final answer as 9 + 5 = 149+5=14.

    However, when the answer is \frac{521}{500}500521​, the reduced fraction is also \frac{521}{500}500521​, so the student should write the final answer as 521 + 500 = 1021521+500=1021. But this shouldn't happen, since all the answers for the short-answer questions are below 1 000. To avoid this situation, the organizers should make sure that after reducing the fraction, the sum of the numerator and the denominator shouldn't exceed 999999. Let's call such fractions as Suneung Fractions. For example, \frac{1996}{2}21996​ and \frac{18}{10}1018​ are Suneung fractions, while \frac{1998}{2}21998​ and \frac{521}{500}500521​ are not.

    Suppose that, this year, one of the organizers wrote a problem, and the answer to that problem is \frac{x}{y}yx​. Since the problem is not finalized yet, the only thing we know is A \le x \le BA≤x≤B and C \le y \le DC≤y≤D holds, for given A, B, C, DA,B,C,D. The organizers want to know, among all the pairs (x, y)(x,y), how many of \frac{x}{y}yx​ is a Suneung fraction. Write a program that counts this number.

    Input

    The first and only line contains four space-separated integers A, B, CA,B,C and DD (1 \le A \le B \le 10^{12}1≤A≤B≤1012, 1 \le C \le D \le 10^{12}1≤C≤D≤1012)

    Output

    Print the number of integral pairs (x, y)(x,y) (A \le x \le BA≤x≤B, C \le y \le DC≤y≤D), where \frac{x}{y}yx​ is a Suneung fraction.

    Sample 1

    InputcopyOutputcopy
    5 8 3 6
    
    16
    

    Sample 2

    InputcopyOutputcopy
    2018 2019 2018 2019
    
    2

    一开始ans没开longlong wa了两发

    1. /*Where there is light, in my heart.*/
    2. /*SUMMER_TRAINING*/
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. using namespace std;
    9. //
    10. #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    11. //#define INF 0x3f3f3f
    12. #define ll long long
    13. #define INF 0x3f3f3f3f
    14. #define mem(a,b) memset(a,b,sizeof(a))
    15. #define unmap(a,b) unordered_map
    16. #define unset(a) unordered_set
    17. #define F first
    18. #define S second
    19. #define pb push_back
    20. #define rep(i, a, b) for (int i = (a); i <= (b); ++i)
    21. #define _rep(i, a, b) for (int i = (a); i >= (b); --i)
    22. #define mode 1e4+7
    23. #define pi acos(-1)
    24. #define U_queue priority_queue,greater >
    25. typedef double db;
    26. typedef pair<int,int> PII;
    27. typedef pair PLL;
    28. typedef vector<int> vi;
    29. const int N = 3e4+5;
    30. //====================================================//
    31. void solve(){
    32. ll a,b,c,d;
    33. scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
    34. ll ans=0;
    35. for(int i=1;i<=998;i++){
    36. for(int j=1;j<=998;j++){
    37. if(i+j>999) continue;
    38. else{
    39. if(__gcd(i,j)!=1){
    40. continue;
    41. }
    42. else{
    43. ll kl=a/i;
    44. if(kl*i
    45. ll kr=b/i;
    46. //----------------------------------------------------------
    47. ll kkl=c/j;
    48. if(kkl*j
    49. ll kkr=d/j;
    50. //----------------------------------------------------------
    51. if(kl>kkr||krcontinue;
    52. else{
    53. ll Kl=max(kl,kkl);
    54. ll Kr=min(kr,kkr);
    55. ans+=Kr-Kl+1;
    56. }
    57. }
    58. }
    59. }
    60. }
    61. cout<
    62. }
    63. signed main(){
    64. int t;
    65. //cin>>t;
    66. t=1;
    67. while(t--){
    68. solve();
    69. }
    70. }
    71. //made by melody 202208

    F - Game on Plane

    You are given NN points on a plane. These points are precisely the set of vertices of some regular NN-gon. Koosaga, an extreme villain, is challenging you with a game using these points. You and Koosaga alternatively take turns, and in each turn, the player

    1. chooses two of the given points, then
    2. draws the line segment connecting the two chosen points.

    Also, the newly drawn line segment must not intersect with any of the previously drawn line segments in the interior. It is possible for two segments to meet at their endpoints. If at any point of the game, there exists a convex polygon consisting of the drawn line segments, the game ends and the last player who made the move wins.

    Given the integer NN, Koosaga is letting you decide who will move first. Your task is decide whether you need to move first or the second so that you can win regardless of Koosaga's moves.

    Input

    The input consists of many test cases. The first line contains an integer TT (1\leq T\leq 50001≤T≤5000), the number of test cases. Each of the following TT test cases is consisted of one line containing the integer NN (3\leq N\leq 50003≤N≤5000).

    Output

    For each test case, print one line containing the string First if you need to move first or Second if you need to move second so that you can win regardless of Koosaga's moves.

    Sample 1

    InputcopyOutputcopy
    2
    3
    5
    
    First
    Second
    

    Sponsor

    博弈 推出sg函数

    1. /*Where there is light, in my heart.*/
    2. /*SUMMER_TRAINING*/
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. using namespace std;
    9. //
    10. #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    11. //#define INF 0x3f3f3f
    12. #define ll long long
    13. #define INF 0x3f3f3f3f
    14. #define mem(a,b) memset(a,b,sizeof(a))
    15. #define unmap(a,b) unordered_map
    16. #define unset(a) unordered_set
    17. #define F first
    18. #define S second
    19. #define pb push_back
    20. #define rep(i, a, b) for (int i = (a); i <= (b); ++i)
    21. #define _rep(i, a, b) for (int i = (a); i >= (b); --i)
    22. #define mode 1e4+7
    23. #define pi acos(-1)
    24. #define U_queue priority_queue,greater >
    25. typedef double db;
    26. typedef pair<int,int> PII;
    27. typedef pair PLL;
    28. typedef vector<int> vi;
    29. const int N = 5010;
    30. //====================================================//
    31. //sg=s[j]^s[i-2-j];
    32. int sg[N],s[N];
    33. void getSG(){
    34. //mem(sg,0);
    35. sg[1]=0;
    36. sg[2]=1;
    37. for(int i=3;i<=5000;i++){
    38. mem(s,0);
    39. for(int j=0;j<=i-2;j++) s[(sg[j]^sg[i-2-j])]=1;
    40. for(int j=0;;j++){
    41. if(!s[j]){
    42. sg[i]=j;
    43. break;
    44. }
    45. }
    46. }
    47. }
    48. void solve(){
    49. int n;
    50. scanf("%d",&n);
    51. if(sg[n]) puts("First");
    52. else puts("Second");
    53. }
    54. signed main(){
    55. getSG();
    56. int t;
    57. scanf("%d",&t);
    58. while(t--){
    59. solve();
    60. }
    61. }
    62. //made by melody 20220804

    L - Repetitive Palindrome

    You are given a string ss consisting of lowercase alphabets, and an integer kk.

    Make a new string tt by concatenating kk copies of ss. Determine whether tt is a palindrome, e.g. is the same backward as forward.

    Input

    The first line contains a string ss consisting of lowercase alphabets. (1 \le |s| \le 2500001≤∣s∣≤250000)

    The second line contains an integer kk. (1 \le k \le 10^{18}1≤k≤1018)

    Output

    If tt is a palindrome, print YES. If not, print NO.

    Sample 1

    InputcopyOutputcopy
    abc
    3
    
    NO
    

    Sample 2

    InputcopyOutputcopy
    abba
    1
    
    YES

     

    签到 判本身是不是回文就行 

    1. /*Where there is light, in my heart.*/
    2. /*SUMMER_TRAINING*/
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. using namespace std;
    9. //
    10. #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    11. //#define INF 0x3f3f3f
    12. #define ll long long
    13. #define INF 0x3f3f3f3f
    14. #define mem(a,b) memset(a,b,sizeof(a))
    15. #define unmap(a,b) unordered_map
    16. #define unset(a) unordered_set
    17. #define F first
    18. #define S second
    19. #define pb push_back
    20. #define rep(i, a, b) for (int i = (a); i <= (b); ++i)
    21. #define _rep(i, a, b) for (int i = (a); i >= (b); --i)
    22. #define mode 1e4+7
    23. #define pi acos(-1)
    24. #define U_queue priority_queue,greater >
    25. typedef double db;
    26. typedef pair<int,int> PII;
    27. typedef pair PLL;
    28. typedef vector<int> vi;
    29. const int N = 3e5+5;
    30. //====================================================//
    31. void solve(){
    32. string s;
    33. int k;
    34. cin>>s;
    35. cin>>k;
    36. //int len=s.size();
    37. string ss;
    38. ss=s;
    39. reverse(s.begin(),s.end());
    40. if(ss==s) cout<<"YES"<
    41. else cout<<"NO"<
    42. }
    43. signed main(){
    44. int t;
    45. //cin>>t;
    46. t=1;
    47. while(t--){
    48. solve();
    49. }
    50. }
    51. //made by melody 20220801

     

    M - Coke Challenge

    Mr. Jeong really loves coke. He loves so much that he drinks coke everyday without exception. One day, he decided to open a coke contest in Daejeon. To the winner, a box of cokes will be given!

    N people participate in the contest. Each participant is given K mL of coke, and the one who finishes his/her coke earliest wins the contest. But it is painful to drink the whole coke in one time, so each person repeats drinking and taking a rest. More specifically, as soon as the contest starts, the ith participant starts to drink for ti seconds, then takes a rest for si seconds, and repeats this process until no more coke remains. Moreover, everyone drinks A mL per second. The contest is over if one of the participants finished his/her coke.

    Given the infomation of N participants, determine after how many seconds the contest is finished, since the contest begins.

    Input

    The input starts with the first line containing three integers N (2 ≤ N ≤ 1000), K (1 ≤ K ≤ 10000), and A (1 ≤ A ≤ 100). The ith of the next N lines contains two integers ti (1 ≤ ti ≤ 100) and si (1 ≤ si ≤ 100), the information of ith participant. K is a multiple of A.

    Output

    Write a single integer, the answer to the question.

    Sample 1

    InputcopyOutputcopy
    2 100 1
    10 5
    5 10
    
    145
    

    Sample 2

    InputcopyOutputcopy
    4 100 2
    30 30
    49 2
    50 50
    20 10
    
    5 
    1. /*Where there is light, in my heart.*/
    2. /*SUMMER_TRAINING*/
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. using namespace std;
    9. //
    10. #define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    11. //#define INF 0x3f3f3f
    12. #define ll long long
    13. #define INF 0x3f3f3f3f
    14. #define mem(a,b) memset(a,b,sizeof(a))
    15. #define unmap(a,b) unordered_map
    16. #define unset(a) unordered_set
    17. #define F first
    18. #define S second
    19. #define pb push_back
    20. #define rep(i, a, b) for (int i = (a); i <= (b); ++i)
    21. #define _rep(i, a, b) for (int i = (a); i >= (b); --i)
    22. #define mode 1e4+7
    23. #define pi acos(-1)
    24. #define U_queue priority_queue,greater >
    25. typedef double db;
    26. typedef pair<int,int> PII;
    27. typedef pair PLL;
    28. typedef vector<int> vi;
    29. const int N = 3e4+5;
    30. //====================================================//
    31. int s[N],t[N];
    32. void solve(){
    33. int n,k,a;
    34. cin>>n>>k>>a;
    35. int Min=INF;
    36. for(int i=0;i
    37. cin>>t[i]>>s[i];
    38. int Sum=k;
    39. int time=0;
    40. time+=k/(t[i]*a)*(t[i]+s[i]);
    41. Sum%=(t[i]*a);
    42. time+=Sum/a;
    43. if(Sum==0)
    44. time-=s[i];
    45. Min=min(Min,time);
    46. }
    47. cout<
    48. }
    49. signed main(){
    50. int t;
    51. //cin>>t;
    52. t=1;
    53. while(t--){
    54. solve();
    55. }
    56. }
    57. //made by melody 20220801

     总结:后期没一块把J K写出来很遗憾  有点累了emm(摆

    配合渐渐找回来了 希望越打越好 加油

  • 相关阅读:
    kubeadm 部署方式修改kube-proxy为 ipvs模式
    python之while循环介绍
    JAVACPU占用过高、内存泄漏问题排查
    【QT】回调函数的实现
    Java的三种技术架构是什么?
    vue项目开发环境工具-node
    C | 在ubuntu22下开发的一些配置
    MyBatis - 参数传递
    分布式共识算法
    【WinMTR】Windows上winmtr的安装使用方法
  • 原文地址:https://blog.csdn.net/LanceLSf/article/details/126165232
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号