討論串[問題] 如何將陣列中重複的值刪掉,只列出不重 …
共 4 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者halaphone (Still Ballin)時間18年前 (2007/12/26 23:14), 編輯資訊
0
0
0
內容預覽:
小弟後來有解出來了,雖然跟大大們的方法比起來,真的是差太多了>"<. 但還是po出來現醜一下.... int[] data ={ 3, 1, 2, 3, 2, 1, 2 };. int a, b = 0, sum;. ArrayList da = new ArrayList();. Array.So
(還有541個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者chhuang (瓶水相逢)時間18年前 (2007/12/26 22:55), 編輯資訊
0
0
1
內容預覽:
int[] data = {3, 1, 2, 3, 2, 1, 2};. List<int> uniqueList = new List<int>();. {. foreach (int i in data). {. if (!uniqueList.Contains(i)). {. uniqueLi
(還有19個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者toki (いまがその時だ)時間18年前 (2007/12/26 19:02), 編輯資訊
0
0
0
內容預覽:
Dictionary<int, int> dic = new Dictionary<int, int>();. foreach (int i in data). {. try{. dic.Add(i, 1);. }catch(ArgumentException){. dic[i]++;. }. }.
(還有142個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者halaphone (Still Ballin)時間18年前 (2007/12/26 15:00), 編輯資訊
0
0
0
內容預覽:
已經大概想出來要怎麼解了. int[] data ={ 3, 1, 2, 3, 2, 1, 2 };. int a, b = 0,sum;. Array.Sort(data);//{1,1,2,2,2,3,3}. for (a = 0; a <= 6; a++). {. sum = 0;. a =
(還有228個字)
首頁
上一頁
1
下一頁
尾頁