結果
| 問題 |
No.91 赤、緑、青の石
|
| コンテスト | |
| ユーザー |
kaiyori_lab
|
| 提出日時 | 2014-12-07 21:24:10 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 690 bytes |
| コンパイル時間 | 2,533 ms |
| コンパイル使用メモリ | 103,760 KB |
| 最終ジャッジ日時 | 2024-11-14 18:57:22 |
| 合計ジャッジ時間 | 3,144 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Main.d(14): Error: cannot implicitly convert expression `sort(array(map(stones)))` of type `SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted)` to `int[]` Main.d(22): Error: function `Main.main.canMake(int[] s, int acc)` is not callable using argument types `(SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted), int)` Main.d(22): cannot pass argument `sort(s)` of type `SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted)` to parameter `int[] s` Main.d(26): Error: function `Main.main.canMake(int[] s, int acc)` is not callable using argument types `(SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted), int)` Main.d(26): cannot pass argument `sort(s)` of type `SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted)` to parameter `int[] s`
ソースコード
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.array;
void main(){
auto stones = readln.chomp.split(" ").map!(to!int).array;
int res;
int tempMin = stones.reduce!min;
res += tempMin;
stones = stones.map!((e) => e - tempMin).array.sort;
int canMake(int[] s, int acc){
bool cond1 = s[2]>2 && s[1]>=1;
bool cond2 = s[2]>4 && s[1]<1;
if(cond1){
s[2] -= 3;
s[1] -= 1;
return canMake(s.sort, acc + 1);
}
else if(cond2){
s[2] -= 5;
return canMake(s.sort, acc+1);
}
else{ return acc; }
}
res += canMake(stones, 0);
res.writeln;
}
kaiyori_lab