题库练习 阅读C++程序填写结果:#include<bits/stdc++.h>

A62498 | 阅读C++程序填写结果:#include<bits/stdc++.h>

来源2024年
时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

阅读C++程序填写结果:

#include<bits/stdc++.h>
using namespace std;
int f(int n, int k){
    if(n == 1)
        return 0;
    else
        return(f(n-1,k)+ k)% n;
}
int main(){
    int n, k;
    scanf("%d%d",&n,&k);
    int s =f(n, k);
    printf("%d\n",s+1);
    return 0;
 }
C++ 编辑器
输入
输出