提出 #20013580


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

#pragma GCC optimize("O3")

const long double EPS = 1e-14;

pair<long double, long double> solve(long double a, long double b, long double c)
{
    long double d = b * b - 4 * a * c;
    if (d < 0)
    return {-1, 0};
    long double x1 = (-b + sqrt(d)) / (2 * a);
    long double x2 = (-b - sqrt(d)) / (2 * a);
    return {x1, x2};
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long double x, y, r;
    cin >> x >> y >> r;
    long long ans = 0;
    r += EPS;
    for (long long i = floor(x - r); i <= ceil(r + x); i++)
    {
        long double t = r * r - (x - i) * (x - i);
        if (t < 0)
            continue;
        long double res = sqrt(t);
        ans += floor(res + y) - ceil(y - res ) + 1;
    }
    cout << ans;
    return 0;

}

提出情報

提出日時
問題 D - Circle Lattice Points
ユーザ GrgaExe
言語 C++ (GCC 9.2.1)
得点 400
コード長 878 Byte
結果 AC
実行時間 17 ms
メモリ 3808 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 46
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All extreme_00.txt, extreme_01.txt, extreme_02.txt, extreme_03.txt, handmade_00.txt, handmade_01.txt, handmade_02.txt, handmade_marginal_00.txt, handmade_marginal_01.txt, handmade_marginal_02.txt, handmade_marginal_03.txt, handmade_marginal_04.txt, handmade_marginal_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_integer_00.txt, random_integer_01.txt, random_integer_02.txt, random_integer_03.txt, random_integer_04.txt, random_integer_05.txt, random_integer_06.txt, random_integer_07.txt, random_integer_08.txt, random_integer_09.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
extreme_00.txt AC 15 ms 3680 KiB
extreme_01.txt AC 11 ms 3668 KiB
extreme_02.txt AC 9 ms 3656 KiB
extreme_03.txt AC 11 ms 3672 KiB
handmade_00.txt AC 2 ms 3656 KiB
handmade_01.txt AC 2 ms 3776 KiB
handmade_02.txt AC 2 ms 3668 KiB
handmade_marginal_00.txt AC 11 ms 3672 KiB
handmade_marginal_01.txt AC 17 ms 3684 KiB
handmade_marginal_02.txt AC 12 ms 3700 KiB
handmade_marginal_03.txt AC 15 ms 3640 KiB
handmade_marginal_04.txt AC 9 ms 3772 KiB
handmade_marginal_05.txt AC 13 ms 3656 KiB
random_00.txt AC 10 ms 3672 KiB
random_01.txt AC 4 ms 3772 KiB
random_02.txt AC 12 ms 3672 KiB
random_03.txt AC 5 ms 3644 KiB
random_04.txt AC 6 ms 3656 KiB
random_05.txt AC 3 ms 3696 KiB
random_06.txt AC 11 ms 3668 KiB
random_07.txt AC 5 ms 3672 KiB
random_08.txt AC 8 ms 3656 KiB
random_09.txt AC 9 ms 3736 KiB
random_10.txt AC 12 ms 3648 KiB
random_11.txt AC 5 ms 3732 KiB
random_12.txt AC 9 ms 3668 KiB
random_13.txt AC 9 ms 3688 KiB
random_14.txt AC 8 ms 3652 KiB
random_15.txt AC 4 ms 3680 KiB
random_16.txt AC 6 ms 3648 KiB
random_17.txt AC 17 ms 3656 KiB
random_18.txt AC 7 ms 3696 KiB
random_19.txt AC 2 ms 3664 KiB
random_integer_00.txt AC 5 ms 3656 KiB
random_integer_01.txt AC 5 ms 3732 KiB
random_integer_02.txt AC 8 ms 3656 KiB
random_integer_03.txt AC 4 ms 3808 KiB
random_integer_04.txt AC 6 ms 3648 KiB
random_integer_05.txt AC 2 ms 3640 KiB
random_integer_06.txt AC 6 ms 3660 KiB
random_integer_07.txt AC 14 ms 3668 KiB
random_integer_08.txt AC 4 ms 3652 KiB
random_integer_09.txt AC 12 ms 3728 KiB
sample_01.txt AC 2 ms 3736 KiB
sample_02.txt AC 2 ms 3668 KiB
sample_03.txt AC 12 ms 3716 KiB