View Code of Problem 97

#include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	string str[1000];
	while(cin >> n && n!=0){
		for(int i = 0; i < n; i++){
			cin >> str[i];
		}
		sort(str, str+n);//直接先排序这样,病毒文件的同名文件会相邻 
		string temp;
		for(int i = 0; i < n-1; i++){
			temp = str[i] + ".exe";
			if(temp == str[i+1]){
				cout << str[i+1] << endl;
			}
		}//如果当前的字符串+.exe后等于下一个字符串,则他是病毒文件 
	}
}

Double click to view unformatted code.


Back to problem 97