送水 C++

送水

https://ac.nowcoder.com/acm/problem/22241

#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int Y, k, n, flag = 1;
    cin >> Y >> k >> n;    
    if(Y > n) cout << -1;
    for(int i = 1; i <= n / k; ++i){
        if(i * k < Y) continue;
        else{
            cout << i * k - Y << ' ';
            flag = 0;
        };
    }
    if(flag) cout << -1;
    return 0;
}

全部评论

相关推荐

鬼迹人途:你去投一投尚游游戏,服务器一面,第一个图算法,做完了给你一个策略题,你给出方案他就提出低概率问题,答不上当场给你挂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务