QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#402400#6812. Draw a triangleStarrykiller#Compile Error//C++23551b2024-04-30 15:09:262024-04-30 15:09:28

Judging History

你现在查看的是最新测评结果

  • [2024-04-30 15:09:28]
  • 评测
  • [2024-04-30 15:09:26]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long 

int x1, y1, x2, y2;

int exgcd(int a, int b, int &x, int &y) {
    if (!a) return x=1, y=0, a;
    int d=exgcd(b,a%b,x,y);
    int z=x; x=y, y=z-y*(a/b);
    return d;
}

void solve() {
    cin>>x1>>y1>>x2>>y2;
    int x=x2-x1, y=y2-y1;
    int a, b;
    exgcd(y,x,a,b);
    cout<<a<<' '<<b<<'\n';
    // 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int T; cin>>T;
    while (T--) solve();
    
}

Details

answer.code:7:9: error: ‘long long int y1’ redeclared as different kind of entity
    7 | int x1, y1, x2, y2;
      |         ^~
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679,
                 from /usr/include/c++/13/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33,
                 from answer.code:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:221:1: note: previous declaration ‘double y1(double)’
  221 | __MATHCALL (y1,, (_Mdouble_));
      | ^~~~~~~~~~
answer.code: In function ‘void solve()’:
answer.code:17:12: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’)
   17 |     cin>>x1>>y1>>x2>>y2;
      |     ~~~~~~~^~~~
      |        |     |
      |        |     double(double) noexcept
      |        std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
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:
/usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  325 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/13/istream:325:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:14: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘void*’ [-fpermissive]
   17 |     cin>>x1>>y1>>x2>>y2;
      |              ^~
      |              |
      |              double (*)(double) noexcept
answer.code:17:14: error: cannot bind rvalue ‘(void*)y1’ to ‘void*&’
/usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  201 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:201:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:14: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long unsigned int’ [-fpermissive]
   17 |     cin>>x1>>y1>>x2>>y2;
      |              ^~
      |              |
      |              double (*)(double) noexcept
answer.code:17:14: error: cannot bind rvalue ‘(long long unsigned int)y1’ to ‘long long unsigned int&’
/usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  197 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:197:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:14: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long int’ [-fpermissive]
   17 |     cin>>x1>>y1>>x2>>y2;
      |              ^~
      |              |
      |              double (*)(double) noexcept
answer.code:17:14: error: cannot bind rvalue ‘(long long int)y1’ to ‘long long int&’
/usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:192:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:14: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long unsigned int’ [-fpermissive]
   17 |     cin>>x1>>y1>>x2>>y2;
      |              ^~
      |              |
      |              double (*)(double) noexcept
answer.code:17:14: error: cannot bind rvalue ‘(long unsigned int)y1’ to ‘long unsigned int&’
/usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/13/istream:188:7: note:   conversion of argument 1 would be ill-formed:
answer.code:17:14: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long int’ [-fpermissive]
   17 |     cin>>x1>>y1>>x2>>y2;
      |    ...