QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#76867#5503. Euclidean AlgorithmTerryWangCompile Error//C111.0kb2023-02-12 14:21:072023-02-12 14:21:10

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-12 14:21:10]
  • 评测
  • [2023-02-12 14:21:07]
  • 提交

answer

#include<stdio.h>
typedef long long ll;

signed main(){
	int T=1;
	scanf("%d",&T);
	for(;T--;){
		ll n=100'000'000'000;
		scanf("%lld",&n);
		// if(n>10'000'000'000)n=10'000'000'000;
		// auto brute1=[&](){
			// ll res=0;
			// for(ll g=1;g<=n;++g){
				// for(ll i=1;i*g<=n;++i){
					// for(ll j=i+1;j*g<=n;++j){
						// if(!((j-1)%i))++res;
					// }
				// }
			// }
			// // std::cerr<<res<<'\n';
			// return res;
		// };
		// auto brute2=[&](){
			// ll res=0;
			// for(ll g=1;g<=n;++g){
				// for(ll i=1;i*g<=n;++i){
					// res+=((n/g)-1)/i;
				// }
			// }
			// // std::cerr<<res<<'\n';
			// return res;
		// };
		// assert(brute1()==brute2());
		ll ans=0;
		for(ll l=1,r;l<=n;l=r+1){
			ll val=n/l;
			r=n/val;
			{
				ll res=0;
				for(ll l=1,r;l<=(val-1);l=r+1){
					// ++time;
					ll val2=(val-1)/l;
					r=(val-1)/val2;
					res+=val2*ll(r-l+1);
				}
				ans+=res*ll(r-l+1);
			}
			
		}
		// assert(ans==brute2());
		printf("%lld\n",ans);
		// std::cerr<<time<<'\n';
	}
}

详细

answer.code: In function ‘main’:
answer.code:8:11: warning: multi-character character constant [-Wmultichar]
   ll n=100'000'000'000;
           ^~~~~
answer.code:8:11: error: expected ‘,’ or ‘;’ before '\x303030'
answer.code:8:19: warning: missing terminating ' character
   ll n=100'000'000'000;
                   ^
answer.code:8:19: error: missing terminating ' character
   ll n=100'000'000'000;
                   ^~~~~
answer.code:44:16: error: expected expression before ‘ll’
      res+=val2*ll(r-l+1);
                ^~
answer.code:46:14: error: expected expression before ‘ll’
     ans+=res*ll(r-l+1);
              ^~
answer.code:6:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&T);
  ^~~~~~~~~~~~~~