Submission #64500470
Source Code Expand
Copy
#include <bits/stdc++.h>#ifdef LOCAL#include <debug.hpp>#else#define debug(...) void(0)#endiftemplate <class T, class U = T> bool chmin(T& x, U&& y) { return y < x and (x = std::forward<U>(y), true); }template <class T, class U = T> bool chmax(T& x, U&& y) { return x < y and (x = std::forward<U>(y), true); }template <class T> void mkuni(std::vector<T>& v) {std::ranges::sort(v);auto result = std::ranges::unique(v);v.erase(result.begin(), result.end());}template <class T> int lwb(const std::vector<T>& v, const T& x) {return std::distance(v.begin(), std::ranges::lower_bound(v, x));}
#include <bits/stdc++.h> #ifdef LOCAL #include <debug.hpp> #else #define debug(...) void(0) #endif template <class T, class U = T> bool chmin(T& x, U&& y) { return y < x and (x = std::forward<U>(y), true); } template <class T, class U = T> bool chmax(T& x, U&& y) { return x < y and (x = std::forward<U>(y), true); } template <class T> void mkuni(std::vector<T>& v) { std::ranges::sort(v); auto result = std::ranges::unique(v); v.erase(result.begin(), result.end()); } template <class T> int lwb(const std::vector<T>& v, const T& x) { return std::distance(v.begin(), std::ranges::lower_bound(v, x)); } using namespace std; using ll = long long; const int INF = 1e9; void solve() { int N, M; cin >> N >> M; ll sum = 0, prod = 1; for (int i = 0; i <= M; i++, prod *= N) { sum += prod; if (sum > INF) { cout << "inf\n"; return; } } cout << sum << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Sum of Geometric Series |
User | rniya |
Language | C++ 23 (gcc 12.2) |
Score | 200 |
Code Size | 1088 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3604 KB |
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 | 3332 KB |
sample01.txt | AC | 1 ms | 3428 KB |
sample02.txt | AC | 1 ms | 3524 KB |
sample03.txt | AC | 1 ms | 3444 KB |
testcase00.txt | AC | 1 ms | 3412 KB |
testcase01.txt | AC | 1 ms | 3328 KB |
testcase02.txt | AC | 1 ms | 3324 KB |
testcase03.txt | AC | 1 ms | 3332 KB |
testcase04.txt | AC | 1 ms | 3468 KB |
testcase05.txt | AC | 1 ms | 3472 KB |
testcase06.txt | AC | 1 ms | 3328 KB |
testcase07.txt | AC | 1 ms | 3528 KB |
testcase08.txt | AC | 1 ms | 3412 KB |
testcase09.txt | AC | 1 ms | 3468 KB |
testcase10.txt | AC | 1 ms | 3328 KB |
testcase11.txt | AC | 1 ms | 3524 KB |
testcase12.txt | AC | 1 ms | 3456 KB |
testcase13.txt | AC | 1 ms | 3400 KB |
testcase14.txt | AC | 1 ms | 3476 KB |
testcase15.txt | AC | 1 ms | 3412 KB |
testcase16.txt | AC | 1 ms | 3472 KB |
testcase17.txt | AC | 1 ms | 3532 KB |
testcase18.txt | AC | 1 ms | 3480 KB |
testcase19.txt | AC | 1 ms | 3392 KB |
testcase20.txt | AC | 1 ms | 3468 KB |
testcase21.txt | AC | 1 ms | 3416 KB |
testcase22.txt | AC | 1 ms | 3604 KB |
testcase23.txt | AC | 1 ms | 3524 KB |
testcase24.txt | AC | 1 ms | 3524 KB |
testcase25.txt | AC | 1 ms | 3384 KB |
testcase26.txt | AC | 1 ms | 3456 KB |
testcase27.txt | AC | 1 ms | 3412 KB |
testcase28.txt | AC | 1 ms | 3388 KB |
testcase29.txt | AC | 1 ms | 3464 KB |
testcase30.txt | AC | 1 ms | 3460 KB |
testcase31.txt | AC | 1 ms | 3392 KB |
testcase32.txt | AC | 1 ms | 3416 KB |