码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • HDU - 6225 Little Boxes(__int128的使用)


    Problem Description
    Little boxes on the hillside.
    Little boxes made of ticky-tacky.
    Little boxes.
    Little boxes.
    Little boxes all the same.
    There are a green boxes, and b pink boxes.
    And c blue boxes and d yellow boxes.
    And they are all made out of ticky-tacky.
    And they all look just the same.

    Input
    The input has several test cases. The first line contains the integer t (1 ≤ t ≤ 10) which is the total number of test cases.
    For each test case, a line contains four non-negative integers a, b, c and d where a, b, c, d ≤ 2^62, indicating the numbers of green boxes, pink boxes, blue boxes and yellow boxes.

    Output
    For each test case, output a line with the total number of boxes.

    Sample Input
    4
    1 2 3 4
    0 0 0 0
    1 0 0 0
    111 222 333 404

    Sample Output
    10
    0
    1
    1070

    #include<cstdio>
    
    inline void read(__int128 &x) 
    {
        int f=1;x=0;char s=getchar();
        while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
        while(s<='9'&&s>='0')x=x*10+(s^48),s=getchar();
        x*=f;
    }
    
    inline void print(__int128 x)
    {
    	if(x<0) putchar('-'),x=-x;
        if(x>9) print(x/10);
        putchar(x%10+'0');
    }
    
    int main()
    {
        int T;scanf("%d",&T);
        while(T--)
        {
            __int128 a,b,c,d;
            read(a);read(b);read(c);read(d);
            print(a+b+c+d);
            puts("");
        }
        return 0;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    import java.math.BigInteger;
    import java.util.Scanner;
    public class Main {
        static Scanner cin = new Scanner(System.in);
        public static void main(String[] args) {
            int T=cin.nextInt();
            while(T-->0)
            {
                BigInteger a=cin.nextBigInteger();
                BigInteger b=cin.nextBigInteger();
                BigInteger c=cin.nextBigInteger();
                BigInteger d=cin.nextBigInteger();
                System.out.println(a.add(b).add(c).add(d));
            }
        }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
  • 相关阅读:
    eventlet 协程
    微服务—RabbitMQ高级(业务在各方面的可靠性)
    抢票攻略来了!疫情后的首届云栖大会
    MR混合现实情景实训教学系统模拟高空作业情景
    Spark(2)-基础tranform算子(一)
    在CentOS7中安装MySQL数据库
    介绍实体类或对象序列化时,忽略为空属性的操作(@JsonInclude(JsonInclude.Include.NON_EMPTY))注解
    【LeetCode热题100】--155.最小栈
    【Hack The Box】windows练习-- Scrambled
    如何理解Spring中的IOC
  • 原文地址:https://blog.csdn.net/qq_52792570/article/details/125445684
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | 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号