QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#76868#5503. Euclidean AlgorithmTerryWangCompile Error//C111.0kb2023-02-12 14:22:092023-02-12 14:22:12

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

answer

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

signed main(){
	int T=1;
	scanf("%d",&T);
	for(;T--;){
		ll n;
		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';
	}
}

Details

answer.code: In function ‘main’:
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);
  ^~~~~~~~~~~~~~
answer.code:9:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&n);
   ^~~~~~~~~~~~~~~~