結果
| 問題 | 
                            No.256 桁の数字を入れ替え (2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             RabbitCP
                         | 
                    
| 提出日時 | 2015-08-05 01:40:10 | 
| 言語 | D  (dmd 2.109.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 858 bytes | 
| コンパイル時間 | 946 ms | 
| コンパイル使用メモリ | 89,984 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-12 02:42:18 | 
| 合計ジャッジ時間 | 1,196 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 WA * 2 | 
コンパイルメッセージ
Main.d(28): Deprecation: foreach: loop index implicitly converted from `size_t` to `int`
ソースコード
/*****************************
 Name         : Yoshitak
 Create Date  : 2015/06/05
 Program Name : main.d
 Problem No.  : 256
*****************************/
/*---------------------
 import
-----------------------*/
import std.stdio;
import std.string;
import std.conv;
import std.array;
/*---------------------
 main
-----------------------*/
int main(string[] args)
{
	//input
	uint[] num;
	string input;
	input = chomp(readln());
	
	//into the arry
	num.length = input.length;
	foreach(int i, char c; input){
		num[i] = to!int(c);
	}
	
	//max is first!!
	int max = 0, tmp;
	for(int i=0; i<2; i++){
		max = i;
		//where is max!?
		for(int j=i+1; j<num.length; j++){
			if(num[max] <= num[j])	max = j;
		}
		
		//first change!!
		tmp = num[i];
		num[i] = num[max];
		num[max] = tmp;
	}
	
	//output
	foreach(int c; num){
		write(to!char(c));
	}
	return 0;
}
            
            
            
        
            
RabbitCP