제출 #1127995

#제출 시각아이디문제언어결과실행 시간메모리
1127995Hurryup_7735팩토리얼 세제곱들의 합 (YDX14_fact)C++20
0 / 1
1 ms328 KiB
//Are You Challenging Me?! #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define endl '\n' #define pb push_back #define pf push_front #define speedyboy ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define all(x) x.begin() , x.end() #define allr(x) x.rbegin() , x.rend() #define F first #define S second #define pll pair<ll , ll> #define pss pair<string , string> #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; const ll sz = 5e5 + 5 , INF = 1e18 , MOD = 10; ll fact[sz]; ll i , j , k , l; void solve(){ ll n , m , sum = 0; cin >> n >> m; ll mn = min(n , 4LL); for(i = 0 ; i <= mn ; i++){ ll hasil = 1; for(j = 1 ; j <= m ; j++) hasil *= fact[i]; sum += hasil % 10; sum %= 10; } cout << sum % 10 << endl; } signed main(){ fact[0] = 1; for(i = 1 ; i <= 5 ; i++){ fact[i] = fact[i - 1] * i; } speedyboy; //open; ll t = 1; //cin >> t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...