結果
問題 |
No.39 桁の数字を入れ替え
|
ユーザー |
|
提出日時 | 2015-06-10 23:25:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 359 bytes |
コンパイル時間 | 1,259 ms |
コンパイル使用メモリ | 159,092 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-06 15:28:24 |
合計ジャッジ時間 | 1,629 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 16 |
ソースコード
#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; }