2015-06-11 20:00:59

【传送门】

 

A题:数学题,简单枚举。

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

#define getmid(l,r) ((l) + ((r) - (l)) / 2)
#define MP(a,b) make_pair(a,b)
#define PB(a) push_back(a)

typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int INF = (1 << 30) - 1;

ll x,y,k,n;

int main(){
    scanf("%I64d%I64d%I64d",&y,&k,&n);
    bool flag = false;
    for(int i = 1; ; ++i){
        x = (ll)i * k - y;
        if(x + y > n) break;
        if(x >= 1){
            printf("%I64d ",x);
            flag = true;
        }
    }
    if(!flag) printf("-1\n");
    else puts("");
    return 0;
}
View Code

相关文章:

  • 2021-06-13
  • 2021-11-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-10-19
猜你喜欢
  • 2021-07-01
  • 2022-01-01
  • 2021-12-29
  • 2022-02-09
  • 2021-05-30
  • 2021-06-05
  • 2021-08-12
相关资源
相似解决方案