零分求解
查看原帖
零分求解
1403535
Wkk810625楼主2024/10/14 21:00

零分求解

#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    long long n,k;
    long long x=0;
    for(int i=0;i<t;i++){
        cin>>n>>k;
        if(k==0){
            cout<<1<<endl;
            return 0;
        }
        for(int j=n/k;j>0;j--){
             if(k*j<=n){
                if(n-k*j<=j){
                    x++;
                } 
             }
        }
        cout<<x<<endl;
    }
    return 0;
}
2024/10/14 21:00
加载中...