1 solutions
-
0
C :
#include<stdio.h> int main() { long long m; long long n,t; scanf("%lld",&m); n=m/1000; t=m-n*1000; if(n>t) printf("%lld",m); else printf("%lld",t*1000+n); return 0; }
C++ :
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; if(n / 1000 > n % 1000){ cout<<n; }else{ cout<<n%1000<<n/1000; } }
Java :
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int q = a/1000; int h = a%1000; if (q<h) { System.out.println(h*1000+q); }else { System.out.println(q*1000+h); } } }
Python :
n = int(input()) sw = n // 100000 % 10 w = n // 10000 % 10 q = n // 1000 % 10 b = n // 100 % 10 s = n // 10 % 10 g = n // 1 % 10 x = sw * 100 + w * 10 + q y = b * 100 + s * 10 + g if x > y: print(n) else: print(b * 100000 + s * 10000 + g * 1000 + sw * 100 + w * 10 + q)
- 1
Information
- ID
- 10198
- Time
- 1000ms
- Memory
- 64MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By