/* #include<iostream>
using namespace std;
int main() {
long long n, ans = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
long long factor = 1;
for (int j = 1; j <= i; j++)
factor *= j;
ans += factor;
}
cout << ans << endl;
return 0;
} */
#include<iostream>
using namespace std;
int main() {
long long n, ans = 0;
long long factor = 1;
cin >> n;
for (int i = 1; i <= n; i++) {
factor *= i;
ans += factor;
}
cout << ans << endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int n, x, ans;
cin >> n >> x;
for (int i = 1; i <= n; i++){
int tmp = i, num;
while (tmp != 0) {
num = tmp % 10;
if (num == x)
ans++;
tmp /= 10;
}
}
cout << ans << endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int k, ans = 0;
cin >> k;
for (double Sn = 0; Sn <= k; ans++, Sn += 1.0 / ans)
cout << ans;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int k, coin = 0, day = 0;
cin >> k;
for (int i = 1;; i++)
for (int j = 1; j <= i; j++) {
coin += i; day++;
if (day == k) {
cout << coin << endl;
return 0;
}
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
int s = 0, n;
cin >> n;
for (int i = 0; i <= n; i++)
s += i;
cout << s;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int s = 0, i = 0, n;
cin >> n;
while (n--) s += ++i;
cout << s;
return 0;
}
C++入门同步记录#9
最新推荐文章于 2024-04-29 22:13:34 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)