1 条题解

  • 0
    @ 2025-7-7 20:52:09

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    int a,b,c;
    void solve() {
        cin>>a>>b>>c;
        cout<<(c-1)/b+1<<' '<<(c-1)/a+1<<'\n';
    }
    int main() {
        int tt = 1;
        cin>>tt;
        while (tt--) solve();
    }
    

    Java :

    import java.util.Scanner;
    
    public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            while (sc.hasNext())
            {
                int n=sc.nextInt();
                for (int i = 0; i < n; i++)
                {
                    double a=sc.nextInt();
                    double b =sc.nextInt();
                    double c=sc.nextInt();
                    System.out.printf("%.0f %.0f\n",Math.ceil(c/b),Math.ceil(c/a));
    
                }
            }
        }
    }
    
    

    Python :

    # coding=utf-8
    import math
    
    while True:
        try:
            T=int(input())
            zd=zs=0
            if 1<=T<=1e5:
                for _ in range(T):
                    a, b, x = map(int, input().split())
                    if 1<=a<=10**9 and 1<=b<=10**9 and 1<=x<=10**9 and a<=b:
                        zd = math.ceil(x/a)
                        zs = math.ceil(x/b)
                        print(str(zs)+" "+str(zd))
        except EOFError:
            break
    
    • 1

    信息

    ID
    260
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    递交数
    2
    已通过
    1
    上传者