刷题统计= =

这是一个用Java编写的程序,主要使用了Scanner类来读取输入,通过循环和条件判断实现特定计算逻辑。代码涉及数学运算、变量更新以及输出处理,目的是解决一个基于给定参数的计数问题。

 

40%的暴力代码:
 

import java.io.*;
import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;

public class Main
{
    static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    static int N = 100010;
    static List<Character> list = new ArrayList<>();

    public static void main(String[] args) throws NumberFormatException, IOException
    {
        long a = rd.nextLong(),b = rd.nextLong();
        long n = rd.nextLong();

        long cnt = 0; // 记录当前题数
        long res = 0; // 记录天数
        while(cnt < n)
        {
             for(int i = 1; i <= 5 ; i ++)
             {
                 cnt += a;
                 res ++;
                 if(cnt >= n)
                 {
                     pw.println(res);
                     pw.flush();
                     return;
                 }
             }
             for(int i = 1 ; i <= 5 ; i ++)
             {
                 cnt += b;
                 res ++;
                 if(cnt >= n)
                 {
                     pw.println(res);
                     pw.flush();
                     return;
                 }
             }
        }
        pw.flush();
    }
}

class rd
{
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer tokenizer = new StringTokenizer("");

    static String nextLine() throws IOException { return reader.readLine(); }
    static String next() throws IOException
    {
        while(!tokenizer.hasMoreTokens())  tokenizer = new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException { return Integer.parseInt(next()); }
    static double nextDouble() throws IOException { return Double.parseDouble(next()); }
    static long nextLong() throws IOException { return Long.parseLong(next()); }
    static BigInteger nextBigInteger() throws IOException
    {
        BigInteger d = new BigInteger(rd.nextLine());
        return d;
    }
}

class PII implements Comparable<PII>
{
    int x,y;
    public PII(int x ,int y)
    {
        this.x = x;
        this.y = y;
    }
    public int compareTo(PII a)
    {
        if(this.x-a.x != 0)
            return this.x-a.x;  //按x升序排序
        else return this.y-a.y;  //如果x相同,按y升序排序
    }
}

class Edge
{
    int a,b,c;
    public Edge(int a ,int b, int c)
    {
        this.a = a;
        this.b = b;
        this.c = c;
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

21RGHLY

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值