제출 #1339077

#제출 시각아이디문제언어결과실행 시간메모리
1339077vjudge1Aliens (IOI07_aliens)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
struct str {
    int x, y, z;
};
int main() 
{
    int a;
    int b;
    int c;
    int d;
    vector<str> pts(b);
    for (int i = 0; i < b; ++i) 
    {
        if (a == 3)
        {
            cin >> pts[i].x;
            cin >> pts[i].y;
            cin >> pts[i].z
        }
        else 
        {
            cin >> pts[i].x;
            cin >> pts[i].y;
            cin >> pts[i].z = 0; 
        }
    }
    int maxm = 0;
    for (int i = 0; i < b; i++) 
    {
        for (int j = i + 1; j < b; j++) 
        {
            int dist = abs(points[i].x - points[j].x) + abs(points[i].y - points[j].y) +abs(points[i].z - points[j].z);
            if (dist <= c) 
            {
                maxm++;
            }
        }
    }
    cout << maxm << endl;
}

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

aliens.cpp: In function 'int main()':
aliens.cpp:19:28: error: expected ';' before '}' token
   19 |             cin >> pts[i].z
      |                            ^
      |                            ;
   20 |         }
      |         ~                   
aliens.cpp:25:31: error: no match for 'operator=' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
   25 |             cin >> pts[i].z = 0;
      |                               ^
In file included from /usr/include/c++/13/sstream:40,
                 from /usr/include/c++/13/complex:45,
                 from /usr/include/c++/13/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
                 from aliens.cpp:1:
/usr/include/c++/13/istream:715:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator=(std::basic_istream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]'
  715 |       operator=(basic_istream&& __rhs)
      |       ^~~~~~~~
/usr/include/c++/13/istream:715:33: note:   no known conversion for argument 1 from 'int' to 'std::basic_istream<char>&&'
  715 |       operator=(basic_istream&& __rhs)
      |                 ~~~~~~~~~~~~~~~~^~~~~
aliens.cpp:33:28: error: 'points' was not declared in this scope; did you mean 'printf'?
   33 |             int dist = abs(points[i].x - points[j].x) + abs(points[i].y - points[j].y) +abs(points[i].z - points[j].z);
      |                            ^~~~~~
      |                            printf