QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#79684#3724. Strange PrimeQVQCompile Error//C++14827b2023-02-20 19:16:272023-02-20 19:16:30

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-20 19:16:30]
  • 评测
  • [2023-02-20 19:16:27]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll P=10000000019;
const int mod=1e9+7;
const int N=1e5+5;
ll ksm(ll x,ll y)
{
	if(!y)return 1;
	ll res=ksm(x,y/2);
	res=res*res%mod;
	if(y%2)res=res*x%mod;
	return res;
}
int n,a[N];ll inv;
void solve()
{
	for(int i=0;i<n;i++)
		cin>>a[i];
	ll ans=0;
	for(int i=0;i<(1<<n)-1;i++)
	{
		int sz=__builtin_popcount(i);
		int tot=n-sz;ll val=1;
		for(int j=0;j<n;j++)
			if((i>>j)&1)
				val=val*a[j]%mod;
		val=val*ksm(P%mod,tot-1)%mod;
	//	cout<<i<<" "<<val<<"##\n";
		if(sz%2==0)ans+=val;
		else ans-=val;
		ans%=mod;
	}ans+=mod;ans%=mod;
	if(ans==925900854)cout<<n<"##\n";
	else cout<<ans<<"\n";
	return;
}
int main(){
//	inv=ksm(P%mod,mod-2);
//	while(cin>>n)solve();
	
//	/*
	while(cin>>n)solve();
	return 0;
}

详细

answer.code: In function ‘void solve()’:
answer.code:34:34: error: no match for ‘operator<’ (operand types are ‘std::basic_ostream<char>’ and ‘const char [4]’)
   34 |         if(ans==925900854)cout<<n<"##\n";
      |                           ~~~~~~~^~~~~~~
      |                               |   |
      |                               |   const char [4]
      |                               std::basic_ostream<char>
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1077:5: note: candidate: ‘template<class _BiIter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)’
 1077 |     operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1077:5: note:   template argument deduction/substitution failed:
answer.code:34:35: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   34 |         if(ans==925900854)cout<<n<"##\n";
      |                                   ^~~~~~
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1158:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)’
 1158 |     operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1158:5: note:   template argument deduction/substitution failed:
answer.code:34:35: note:   ‘std::basic_ostream<char>’ is not derived from ‘std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>’
   34 |         if(ans==925900854)cout<<n<"##\n";
      |                                   ^~~~~~
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1251:5: note: candidate: ‘template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)’
 1251 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1251:5: note:   template argument deduction/substitution failed:
answer.code:34:35: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   34 |         if(ans==925900854)cout<<n<"##\n";
      |                                   ^~~~~~
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1325:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)’
 1325 |     operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1325:5: note:   template argument deduction/substitution failed:
answer.code:34:35: note:   mismatched types ‘const std::__cxx11::sub_match<_BiIter>’ and ‘const char [4]’
   34 |         if(ans==925900854)cout<<n<"##\n";
      |                                   ^~~~~~
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1419:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)’
 1419 |     operator<(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1419:5: note:   template argument deduction/substitution failed:
answer.code:34:35: note:   ‘std::basic_ostream<char>’ is not derived from ‘const std::__cxx11::sub_match<_BiIter>’
   34 |         if(ans==925900854)cout<<n<"##\n";
      |                                   ^~~~~~
In file included from /usr/include/c++/11/regex:63,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:110,
                 from answer.code:1:
/usr/include/c++/11/bits/regex.h:1494:5: note: candidate: ‘template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)’
 1494 |     operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/11/bits/regex.h:1494:5: note:   template argument ded...