1 条题解
-
0
C :
#include<stdio.h> int main() { int a; scanf("%d",&a); printf("%d",a+a%10+a/10%10+a/100%10+a/1000); return 0; }
C++ :
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int q = n / 1000; int b = n / 100 % 10; int s = n / 10 % 10; int g = n % 10; cout<<n + q + b + s + g; }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int g = x % 10 ; int s = x / 10 % 10 ; int b = x / 100 % 10; int q = x / 1000; int sum = g + s + b + q ; int sum1 = sum + x; System.out.println(sum1); } }
Python :
a=int(input()) b=a//1000 c=a//100%10 d=a//10%10 e=a%10 print(a+b+c+d+e)
- 1
信息
- ID
- 2529
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 10
- 标签
- 递交数
- 4
- 已通过
- 1
- 上传者