제출 #172795

#제출 시각아이디문제언어결과실행 시간메모리
172795juggernautGift (IZhO18_nicegift)C++14
0 / 100
188 ms14112 KiB
//Just try and the idea will come!
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int n,k,i,a,b,j,ind;
main(){
    scanf("%lld%lld%lld",&n,&k,&a);
    if((n*a)%k!=0){
        puts("-1");
        return 0;
    }
    if(a%(__gcd(n,k))!=0)return 1;
    b=a/(k/__gcd(n,k));
    ind=n*a/k/b;
    i=0;
    printf("%lld\n",ind);
    while(ind--){
        printf("%lld",b);
        for(j=0;j<k;j++)printf(" %lld",(i+j)%n+1);
        i=(i+1)%n;
        puts("");
    }
}

컴파일 시 표준 에러 (stderr) 메시지

nicegift.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
nicegift.cpp: In function 'int main()':
nicegift.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld%lld%lld",&n,&k,&a);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...