結果
問題 | No.39 桁の数字を入れ替え |
ユーザー |
|
提出日時 | 2015-06-10 23:29:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 360 bytes |
コンパイル時間 | 1,268 ms |
コンパイル使用メモリ | 159,116 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 06:25:14 |
合計ジャッジ時間 | 1,953 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll tbl[10]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000}; int main(){ ll v;cin>>v; ll a[10]={0};int i=0; for(int u=v;u && i<10;i++) { a[i]=u%10; u/=10; } ll ma=0; for(int j=0;j<i;j++){ for(int k=0;k<i;k++){ ma=max(ma,-(tbl[j]-tbl[k])*(a[j]-a[k])); } } cout<<v+ma<<endl; }