QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#770355#9622. 有限小数k1nsom#Compile Error//C++20956b2024-11-21 21:32:432024-11-21 21:32:45

Judging History

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

  • [2024-11-21 21:32:45]
  • 评测
  • [2024-11-21 21:32:43]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
#define endl '\n'
#define int __int128

void solve()
{
    int a, b;
    long long xx;
    cin >> xx;
    a = xx;
    cin >> xx;
    b = xx;
    const int up = 1e35;
    pair<long long, long long> ans = {up, up};
    for (int i = 1; b * i <= up; i *= 2)
    {
        for (int j = 1; b * i * j <= up; j *= 5)
        {
            int d = b * i * j;
            if (d > up)
                break;
            int v = a * i * j;
            int k = (v + b - 1) / b;
            int aa = k * b - v, bb = d, gd = __gcd(aa, bb);
            aa /= gd, bb /= gd;
            if (bb <= 1e9)
                ans = min(ans, {aa, bb});
        }
    }
    auto [c, d] = ans;
    cout << c << ' ' << d << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--)
    {
        solve();
    }

    return 0;
}

详细

answer.code: In function ‘int main()’:
answer.code:40:9: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘__int128’)
   40 |     cin >> T;
      |     ~~~ ^~ ~
      |     |      |
      |     |      __int128
      |     std::istream {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,
                 from answer.code:1:
/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:40:12: error: invalid conversion from ‘__int128’ to ‘void*’ [-fpermissive]
   40 |     cin >> T;
      |            ^
      |            |
      |            __int128
answer.code:40:12: error: cannot bind rvalue ‘(void*)((long int)T)’ to ‘void*&’
/usr/include/c++/13/istream:224:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  224 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/13/istream:224:7: note:   conversion of argument 1 would be ill-formed:
answer.code:40:12: error: cannot bind non-const lvalue reference of type ‘long double&’ to a value of type ‘__int128’
   40 |     cin >> T;
      |            ^
/usr/include/c++/13/istream:220:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  220 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/13/istream:220:7: note:   conversion of argument 1 would be ill-formed:
answer.code:40:12: error: cannot bind non-const lvalue reference of type ‘double&’ to a value of type ‘__int128’
   40 |     cin >> T;
      |            ^
/usr/include/c++/13/istream:216:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match)
  216 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/13/istream:216:7: note:   conversion of argument 1 would be ill-formed:
answer.code:40:12: error: cannot bind non-const lvalue reference of type ‘float&’ to a value of type ‘__int128’
   40 |     cin >> T;
      |            ^
/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:40:12: error: cannot bind non-const lvalue reference of type ‘long long unsigned int&’ to a value of type ‘__int128’
   40 |     cin >> T;
      |            ^
/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:40:12: error: cannot bind non-const lvalue reference of type ‘long long int&’ to a value of type ‘__int128’
   40 |     cin >> T;
      |            ^
/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:40:12: error: cannot bind non-const lvalue reference of type ‘long unsigned int&’ to a value of type ‘__int128’
   40 |     cin >> T;
      |            ^
/usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT...