제출 #59653

#제출 시각아이디문제언어결과실행 시간메모리
59653spencercompton미술 수업 (IOI13_artclass)C++17
컴파일 에러
0 ms0 KiB
#include <stdio.h> #include "artclass.h" #include <bits/stdc++.h> using namespace std; static int DIM[2]; static int R[500][500]; static int G[500][500]; static int B[500][500]; int main() { // FILE *in = fopen("artclass.txt", "r"); for(int aa = 1; aa<=4; aa++){ for(int bb = 1; bb<=9; bb++){ string str = "images\\style-" + to_string(aa) +"\\style-" + to_string(aa) +"-"+to_string(bb)+".txt"; ifstream in1(str); ofstream out1("artclass.txt"); int hh, ww; in1 >> hh >> ww; out1 << hh << " " << ww << endl; for(int i = 0; i<hh*ww; i++){ int x, y, z; in1 >> x >> y >> z; out1 << x << " " << y << " " << z << endl; } in1.close(); out1.close(); // cout << aa << " " << bb<< ":"; // string str = "artclass.txt"; FILE *in = fopen("artclass.txt", "r"); if(in == NULL) { puts("Failed to open input file (artclass.txt)."); return 0; } if(fscanf(in, "%d%d", DIM, DIM+1) != 2) { printf("Line 1: H, W must be integers\n"); return 0; } if(DIM[0] < 100 || 500 < DIM[0]) { printf("Line 1: 100 <= H <= 500\n"); return 0; } if(DIM[1] < 100 || 500 < DIM[1]) { printf("Line 1: 100 <= W <= 500\n"); return 0; } for(int i = 0; i< DIM[0]; i++) { for(int j = 0; j < DIM[1]; j++) { if(fscanf(in, "%d%d%d", &R[i][j], &G[i][j], &B[i][j]) != 3) { printf("Line %d: R[i][j], G[i][j], B[i][j] must be integers", i*DIM[1]+j+2, i, j); return 0; } if(R[i][j] < 0 || 255 < R[i][j]) { printf("Line %d: 0 <= R[%d][%d] <= 255", i*DIM[1]+j+2, i, j); return 0; } if(G[i][j] < 0 || 255 < G[i][j]) { printf("Line %d: 0 <= G[%d][%d] <= 255", i*DIM[1]+j+2, i, j); return 0; } if(B[i][j] < 0 || 255 < B[i][j]) { printf("Line %d: 0 <= B[%d][%d] <= 255", i*DIM[1]+j+2, i, j); return 0; } } } // style(DIM[0], DIM[1], R, G, B); // cout << aa << "));" << endl; cout << "EXPECTED " << aa << endl; printf("%d\n", style(DIM[0], DIM[1], R, G, B)); } } return 0; }

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

artclass.cpp: In function 'int main()':
artclass.cpp:50:98: warning: too many arguments for format [-Wformat-extra-args]
                  printf("Line %d: R[i][j], G[i][j], B[i][j] must be integers", i*DIM[1]+j+2, i, j);
                                                                                                  ^
/tmp/ccasxKm2.o: In function `main':
artclass.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc3gsE4W.o:grader.c:(.text.startup+0x0): first defined here
/tmp/cc3gsE4W.o: In function `main':
grader.c:(.text.startup+0x21a): undefined reference to `style'
/tmp/ccasxKm2.o: In function `main':
artclass.cpp:(.text.startup+0x5ed): undefined reference to `style'
collect2: error: ld returned 1 exit status