Submission #64509110
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*
Author=UTKARSH
*/
/*
------------------------------------------------------------------------
░██╗░░░░░░░██╗░█████╗░██████╗░██╗░░██╗ ██╗░░██╗░█████╗░██████╗░██████╗░
░██║░░██╗░░██║██╔══██╗██╔══██╗██║░██╔╝ ██║░░██║██╔══██╗██╔══██╗██╔══██╗
░╚██╗████╗██╔╝██║░░██║██████╔╝█████═╝░ ███████║███████║██████╔╝██║░░██║
░░████╔═████║░██║░░██║██╔══██╗██╔═██╗░ ██╔══██║██╔══██║██╔══██╗██║░░██║
░░╚██╔╝░╚██╔╝░╚█████╔╝██║░░██║██║░╚██╗ ██║░░██║██║░░██║██║░░██║██████╔╝
░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚═╝╚═╝░░╚═╝ ╚═╝░░╚═╝╚═╝░░╚═╝╚═╝░░╚═╝╚═════╝░
------------------------------------------------------------------------
*/
#include "bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long double lld;
typedef long long int ll;
typedef long double ld;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define en "\n"
#define pb push_back
#define ppb pop_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<ll, ll>
#define mp make_pair
#define all(n) n.begin(), n.end()
#define ff first
#define ss second
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define sz(x) (int)((x).size())
#define mem1(a) memset(a,-1, sizeof(a))
#define mem0(a) memset(a,0,sizeof(a))
#define ppc __builtin_popcount
#define ppcll __builtin_popcountll
#define loop(i, a, b) for (int i = (a); i < (b); i++)
#define looprev(i, a, b) for (int i = (a); i >= (b); i--)
#define logarr(arr,a,b) for(int z=(a);z<(b);z++) cout<<(arr[z])<<" ";cout<<endl;
#define pt(a,b) cout<<a<<" "<<b<<"\n";
#ifndef ONLINE_JUDGE
#include "debug.hpp"
#else
#define debug(x)
#endif
template <typename T> T gcd(T a, T b) {if (b && a % b) return gcd(b, a % b); return b;}
template <typename T> T lcm(T a, T b) {return (a * (b / gcd(a, b)));}
template<typename T> void inline in(vector<T> &v, ll n) {
v.resize(n); for (ll i = 0; i < n; i++) cin >> v[i];
}
bool inline isVowel (char c) {
return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');
}
template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.ff>>a.ss;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.ff<<" "<<a.ss;return out;}
template<typename T,typename T1>T amax(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T amin(T &a,T1 b){if(b<a)a=b;return a;}
ll mod_add(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a + b) % m) + m) % m;}
ll mod_mul(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a * b) % m) + m) % m;}
ll mod_sub(ll a, ll b, ll m) {a = a % m; b = b % m; return (((a - b) % m) + m) % m;}
const long long INF=1e9;
const long long N=2e6+5;
//Code here.....boom-->:):):):):)
ll power(ll a, ll b) //a is base, b is exponent
{
if(b==0)
return 1;
if(b==1)
return a;
if(b%2 == 1)
return (power(a,b-1)*a);
ll q = power(a,b/2);
return (q*q);
}
void solve(){
ll n,m;cin>>n>>m;
ll x=0;
for(int i=0;i<=m && x<INF;i++){
x+=power(n,i);
}
if(x>INF){
cout<<"inf"<<en;
}else cout<<x<<en;
}
int main()
{
FIO;
cout << setprecision(8) << fixed;
int t=1;
// cin>>t;
for(int tcase=1;tcase<=t;tcase++){
// cout<<"Case #"<<tcase<<": ";
solve();
}
return 0;
}
Submission Info
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample00.txt, sample01.txt, sample02.txt, sample03.txt |
All |
sample00.txt, sample01.txt, sample02.txt, sample03.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt |
Case Name |
Status |
Exec Time |
Memory |
sample00.txt |
AC |
1 ms |
3524 KB |
sample01.txt |
AC |
1 ms |
3420 KB |
sample02.txt |
AC |
1 ms |
3472 KB |
sample03.txt |
AC |
1 ms |
3524 KB |
testcase00.txt |
AC |
1 ms |
3456 KB |
testcase01.txt |
AC |
1 ms |
3388 KB |
testcase02.txt |
AC |
1 ms |
3396 KB |
testcase03.txt |
AC |
1 ms |
3408 KB |
testcase04.txt |
AC |
1 ms |
3600 KB |
testcase05.txt |
AC |
1 ms |
3352 KB |
testcase06.txt |
AC |
1 ms |
3468 KB |
testcase07.txt |
AC |
1 ms |
3460 KB |
testcase08.txt |
AC |
1 ms |
3468 KB |
testcase09.txt |
AC |
1 ms |
3524 KB |
testcase10.txt |
AC |
1 ms |
3460 KB |
testcase11.txt |
AC |
1 ms |
3460 KB |
testcase12.txt |
AC |
1 ms |
3448 KB |
testcase13.txt |
AC |
1 ms |
3460 KB |
testcase14.txt |
AC |
1 ms |
3464 KB |
testcase15.txt |
AC |
1 ms |
3384 KB |
testcase16.txt |
AC |
1 ms |
3528 KB |
testcase17.txt |
AC |
1 ms |
3480 KB |
testcase18.txt |
AC |
1 ms |
3412 KB |
testcase19.txt |
AC |
1 ms |
3396 KB |
testcase20.txt |
AC |
1 ms |
3460 KB |
testcase21.txt |
AC |
1 ms |
3524 KB |
testcase22.txt |
AC |
1 ms |
3468 KB |
testcase23.txt |
AC |
1 ms |
3608 KB |
testcase24.txt |
AC |
1 ms |
3324 KB |
testcase25.txt |
AC |
1 ms |
3392 KB |
testcase26.txt |
AC |
1 ms |
3348 KB |
testcase27.txt |
AC |
1 ms |
3524 KB |
testcase28.txt |
AC |
1 ms |
3596 KB |
testcase29.txt |
AC |
1 ms |
3448 KB |
testcase30.txt |
AC |
1 ms |
3476 KB |
testcase31.txt |
AC |
1 ms |
3468 KB |
testcase32.txt |
AC |
1 ms |
3400 KB |