一道小小的红题 不知道哪里出错了
  • 板块题目总版
  • 楼主Zhe8468
  • 当前回复4
  • 已保存回复4
  • 发布时间2021/8/25 16:03
  • 上次更新2023/11/4 09:04:25
查看原帖
一道小小的红题 不知道哪里出错了
185348
Zhe8468楼主2021/8/25 16:03
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,tot=0;
    cin>>n;
    for(int x=100,k=1;x>=1;x--,k++)
    {
        tot = 0;
        for(int i=1;i<=52;i++)
        {
            for(int j=0;j<7;j++)
            {
                tot += x+j*k;
                if(tot==n){
                    cout<<x<<endl;
                    cout<<k<<endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

求助大佬 P4956

2021/8/25 16:03
加载中...