QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#202506#5503. Euclidean Algorithmdanielkou5855Compile Error//C++17720b2023-10-06 09:50:472023-10-06 09:50:47

Judging History

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

  • [2023-10-06 09:50:47]
  • 评测
  • [2023-10-06 09:50:47]
  • 提交

answer

/ Source: https://usaco.guide/general/io

#include <bits/stdc++.h>

#pragma GCC optimize("O3")
#pragma GCC target("avx2")

#define ll long long

using namespace std;

void solve() {
	ll N; cin >> N;

	ll ct = 0;

	for (ll r = 1; r <= N; r = N / (N / r) + 1) {
		// do something with N / r
		ll fixed = N / r;
		ll M = fixed - 1;

		ll last = N / (N / r);
		// cout << r << " " << last << "\n";

		for (ll p = 1; p <= M; p = M / (M / p) + 1) {
			ll next = M / (M / p);
			ct += (last - r + 1) * (next - p + 1) * (M / p);
		}

		// cout << ct << "\n";
	}

	cout << ct << "\n";
}

int main() {
	cin.tie(0) -> sync_with_stdio(0);

	int T; cin >> T;

	while (T--) {
		solve();
	}
}

詳細信息

answer.code:1:1: error: expected unqualified-id before ‘/’ token
    1 | / Source: https://usaco.guide/general/io
      | ^
In file included from /usr/include/c++/11/cmath:43,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/include/c++/11/ext/type_traits.h:162:35: error: ‘bool __gnu_cxx::__is_null_pointer’ redeclared as different kind of entity
  162 |   __is_null_pointer(std::nullptr_t)
      |                                   ^
/usr/include/c++/11/ext/type_traits.h:157:5: note: previous declaration ‘template<class _Type> bool __gnu_cxx::__is_null_pointer(_Type)’
  157 |     __is_null_pointer(_Type)
      |     ^~~~~~~~~~~~~~~~~
/usr/include/c++/11/ext/type_traits.h:162:26: error: ‘nullptr_t’ is not a member of ‘std’
  162 |   __is_null_pointer(std::nullptr_t)
      |                          ^~~~~~~~~
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/include/c++/11/type_traits:431:26: error: ‘std::size_t’ has not been declared
  431 |   template<typename _Tp, std::size_t _Size>
      |                          ^~~
/usr/include/c++/11/type_traits:432:25: error: ‘_Size’ was not declared in this scope
  432 |     struct is_array<_Tp[_Size]>
      |                         ^~~~~
/usr/include/c++/11/type_traits:432:31: error: template argument 1 is invalid
  432 |     struct is_array<_Tp[_Size]>
      |                               ^
/usr/include/c++/11/type_traits:537:42: error: ‘nullptr_t’ is not a member of ‘std’
  537 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                          ^~~~~~~~~
/usr/include/c++/11/type_traits:537:51: error: template argument 1 is invalid
  537 |     struct __is_null_pointer_helper<std::nullptr_t>
      |                                                   ^
/usr/include/c++/11/type_traits:1361:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1361 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                     ^~~~~~
In file included from /usr/include/stdlib.h:31,
                 from /usr/include/c++/11/bits/std_abs.h:38,
                 from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/lib/gcc/x86_64-linux-gnu/11/include/stddef.h:209:23: note: ‘size_t’ declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/include/c++/11/type_traits:1361:57: error: template argument 1 is invalid
 1361 |     : public integral_constant<std::size_t, alignof(_Tp)>
      |                                                         ^
/usr/include/c++/11/type_traits:1361:57: note: invalid template non-type parameter
/usr/include/c++/11/type_traits:1370:37: error: ‘size_t’ is not a member of ‘std’; did you mean ‘size_t’?
 1370 |     : public integral_constant<std::size_t, 0> { };
      |                                     ^~~~~~
In file included from /usr/include/stdlib.h:31,
                 from /usr/include/c++/11/bits/std_abs.h:38,
                 from /usr/include/c++/11/cmath:47,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/lib/gcc/x86_64-linux-gnu/11/include/stddef.h:209:23: note: ‘size_t’ declared here
  209 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from answer.code:3:
/usr/include/c++/11/type_traits:1370:46: error: template argument 1 is invalid
 1370 |     : public integral_constant<std::size_t, 0> { };
      |                                              ^
/usr/include/c++/11/type_traits:1370:46: note: invalid template non-type parameter
/usr/include/c++/11/type_traits:1372:26: error: ‘std::size_t’ has not been declared
 137...