Submission #1252567

#TimeUsernameProblemLanguageResultExecution timeMemory
1252567nicecoder37Trol (COCI19_trol)C++20
50 / 50
0 ms328 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL) #define fi first #define se second #define space " " #define endl "\n" #define gcd __gcd #define mp make_pair #define pb push_back #define pf push_front #define lb lower_bound #define ub upper_bound #define md 1000000007 #define inf 1000000000 #define li 500005 #define int long long using namespace std; int T,Q,n,m,k,a[li]; string s,t; vector<int> v; int32_t main(){ scanf("%lld",&T); while(T--){ scanf("%lld %lld",&n,&m); int sayi=m-n+1,cev=0; if(sayi<=50){ for(int i=n;i<=m;i++){ if(i%9==0) cev+=9; else cev+=i%9; } } else{ for(int i=n;i<=m;i++){ if(i%9==0) cev+=9; else cev+=i%9; if(i%9==0) break; } for(int i=m;i>=n;i--){ if(i%9==0) cev+=9; else cev+=i%9; if(i%9==1) break; } if(m%9==0) sayi-=9; else sayi-=m%9; if(n%9==0) sayi-=1; else sayi-=9-(n%9)+1; cev+=sayi*5; } printf("%lld\n",cev); } return 0; }

Compilation message (stderr)

trol.cpp: In function 'int32_t main()':
trol.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%lld",&T);
      |         ~~~~~^~~~~~~~~~~
trol.cpp:26:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |                 scanf("%lld %lld",&n,&m);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...