编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#5424 #1051. 相思树 Compile Error 0 0 ms 0 K C++ 17 / 886 B TosakaUCW 2024-04-27 15:47:05
显示原始代码
#include <bits/stdc++.h>
#define int long long

using pii = std::pair<int, int>;
using tuu = std::tuple<int, int, int>;
#define pb push_back

using std::cin, std::cout, std::string, std::vector;
int read(int x = 0, int f = 0, char ch = getchar()) {
    while (ch < 48 or 57 < ch) f = ch == 45, ch = getchar();
    while (48 <= ch and ch <= 57) x = x * 10 + ch - 48, ch = getchar();
    return f ? -x : x;
}
void solve() {
    int A = read(), K = read(), L = read(), R = read();
    int P = 0;
    if (A >= L)
        A = A - K * ((A - L) / K);
    else if (A <= L)
        A = A + K * ((L - A) / K + (((L - A) % K) != 0));
    // int ans = (R - A) / K + (((R - A) % K == 0));
    printf("%lld %lld %lld %lld\n", A, K, L, R);
    cout << ans;
}

signed main() {
#ifndef ONLINE_JUDGE
    // freopen("D.in", "r", stdin);
#endif
    for (int T = 1; T--; solve())
        ;
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'void solve()':
/sandbox/1/a.cpp:21:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     cout << ans;
      |             ^~~
      |             abs