ふらっとC#,C♯,C#(初心者用) Part31
at TECH
515:508
08/10/05 22:29:30
>>509
public static int[] Maxs(int[] arr)
{
int max = Int32.MinValue;
int cnt = arr.Length == 0 ? 0 : 1;
foreach(int value in arr)
{
if(value == max)
cnt++;
if(value > max)
{
max = value;
cnt = 1;
}
}
int[] result = new int[cnt];
for(int i = 0; i < cnt; i++)
result[i] = max;
return result;
}
うーん、こうかな…
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5377日前に更新/215 KB
担当:undef