码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • A. Marathon


    time limit per test

    1 second

    memory limit per test

    256 megabytes

    input

    standard input

    output

    standard output

    You are given four distinct integers aa, bb, cc, dd.

    Timur and three other people are running a marathon. The value aa is the distance that Timur has run and bb, cc, dd correspond to the distances the other three participants ran.

    Output the number of participants in front of Timur.

    Input

    The first line contains a single integer tt (1≤t≤1041≤t≤104) — the number of test cases.

    The description of each test case consists of four distinct integers aa, bb, cc, dd (0≤a,b,c,d≤1040≤a,b,c,d≤104).

    Output

    For each test case, output a single integer — the number of participants in front of Timur.

    Example

    input

    Copy

    4
    2 3 4 1
    10000 0 1 2
    500 600 400 300
    0 9999 10000 9998
    

    output

    Copy

    2
    0
    1
    3
    

    Note

    For the first test case, there are 22 people in front of Timur, specifically the participants who ran distances of 33 and 44. The other participant is not in front of Timur because he ran a shorter distance than Timur.

    For the second test case, no one is in front of Timur, since he ran a distance of 1000010000 while all others ran a distance of 00, 11, and 22 respectively.

    For the third test case, only the second person is in front of Timur, who ran a total distance of 600600 while Timur ran a distance of 500500.

    解题说明:水题,直接判断大小即可。

    1. #include"stdio.h"
    2. #include"math.h"
    3. int main()
    4. {
    5. int t;
    6. scanf("%d", &t);
    7. while (t--)
    8. {
    9. int a[4];
    10. int i, e = 0;
    11. for (i = 0; i<4; i++)
    12. {
    13. scanf("%d", a + i);
    14. }
    15. for (i = 1; i<4; i++)
    16. {
    17. if (a[i]>a[0])
    18. {
    19. e++;
    20. }
    21. }
    22. printf("%d\n", e);
    23. }
    24. return 0;
    25. }

  • 相关阅读:
    g2o的hessian矩阵、b怎么存储
    Python爬虫-requests.exceptions.SSLError: HTTPSConnectionPool疑难杂症解决(1)
    @SentinelResource(4)
    PDF怎么翻译成中文?这些方法值得收藏
    数据卷(Data Volumes)&dockerfile
    【服务器安装mysql】centos7下使用mysql离线安装包安装mysql5.7
    深入理解享元模式(Flyweight Pattern)及其实际应用
    【日志系统最全】Spring Cloud Sleuth使用ELK收集&amp;分析日志
    Git 代码提交注释管理规范
    net.sf.json对象转jsonobject
  • 原文地址:https://blog.csdn.net/jj12345jj198999/article/details/125452722
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | 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号