Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:大牛们..路过帮看一下吧...无限WAIn Reply To:大牛们..路过帮看一下吧...无限WA Posted by:DeanL at 2010-05-18 08:37:41 题目错了,当没有重复时,不输出任何东西 > #include<iostream> > #include<algorithm> > using namespace std; > char tel[100]; > char flag[26] = "2223334445556667077888999"; > struct Array > { > char num[10]; > } > data[110000]; > int operator < (Array const& arr1, Array const& arr2) > { > return strcmp(arr1.num, arr2.num) < 0; > } > void sa(int n) > { > int j = -1, k = -1; > while (k < 8) > { > j++; > if (tel[j] == '-') > continue; > k++; > if (k == 3) > { > data[n].num[k] = '-'; > k++; > } > if (tel[j] >= 'A' && tel[j] <= 'Z') > { > data[n].num[k] = flag[tel[j] - 'A']; > continue; > } > data[n].num[k] = tel[j]; > } > data[n].num[k] = '\0'; > } > int main() > { > int n; > int k = 1; > int j = 0; > int temp; > cin >> n; > for (int i = 0;i < n;i++) > { > cin >> tel; > sa(i); > } > sort(data , data + n); > while (j < n) > { > temp = j; > j++; > while (j < n && strcmp(data[j].num , data[temp].num) == 0) > j++; > if (j - temp > 1) > { > cout << data[temp].num << ' ' << j - temp << endl; > k = 0; > } > if (k == 1) > { > cout << "No duplicates." << endl; > } > } > system("pause"); > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator