結果

問題 No.2797 Square Tile
ユーザー askr58askr58
提出日時 2024-06-28 23:42:09
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 760 bytes
コンパイル時間 5,110 ms
コンパイル使用メモリ 307,444 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-28 23:42:18
合計ジャッジ時間 6,801 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 51 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 26 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 20 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 7 ms
5,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 7 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}
int main()
{
    int a,b;
    cin>>a>>b;
    int g=gcd(a,b);
    a/=g;b/=g;
    int m=a*a+b*b;
    int n=m*g*g;
    
    if(a<b)swap(a,b);
    for(int i=0;i<g;i++){
        for(int j=0;j<g;j++){
            for(int k=0;k<m;k++){
                int x=i*g+b*k,y=j*g+a*k;
                cout<<x*g%n<<" "<<y*g%n<<endl;
            }
        }
    }
    for(int i=0;i<g;i++){
        for(int j=0;j<g;j++){
            for(int k=0;k<m;k++){
                int x=i*g+b*k,y=j*g+a*k+a;
                cout<<x*g%n<<" "<<y*g%n<<endl;
            }
        }
    }
    return 0;
}
0