1 条题解

  • 2
    @ 2026-7-8 15:40:04

    #include <bits/stdc++.h> using namespace std;

    int main() { int n, ans = 0, s = 0; cin >> n; while (n > 0) { n = n / 10; ans++; } cout << ans << " "; if (ans % 2 != 0) { for (int i = 1; i <= ans; i += 2) { s = s + i; } } else if (ans % 2 == 0) { for (int i = 2; i <= ans; i += 2) { s = s + i; } } cout << s; return 0; }

    • @ 2026-7-8 15:40:54

      包对的,直接交,记得点赞^^

信息

ID
30376
时间
1000ms
内存
256MiB
难度
8
标签
递交数
20
已通过
7
上传者