Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
142718 | 罗嘉为 | Blah数集 | C++ | 通过 | 100 | 0 MS | 376 KB | 424 | 2024-04-08 22:50:25 |
#include<bits/stdc++.h> using namespace std; int a[110000]; int s, n; void f(int s, int n) { int x = 2; a[1] = s; int b = 1, c = 1; while(x <= n){ long long t1 = a[b] * 2 + 1, t2 = a[c] * 3 + 1; int t = min(t1, t2); if(t1 < t2) b++; else c++; if(t == a[x - 1]) continue; a[x++] = t; } cout << a[n] << endl; } int main(){ while(cin >> s >> n){ f(s, n); } return 0; }