1 条题解

  • 0
    @ 2025-10-10 19:43:50

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int n,k;
    	cin>>n>>k;
    	if(n<=k) cout<<2;
    	else if(n*2%k==0) cout<<(n*2)/k;
    	else cout<<(n*2)/k+1;
    	return 0;
    }
    

    Pascal :

    var n,k:integer;
    begin
    read(n,k);
    if n<=k then write(2)
    else write((n*2-1)div k+1);
    end.
    
    • 1

    信息

    ID
    922
    时间
    1000ms
    内存
    512MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者