SRM 145 DIV 2 (250)
Programming/SRM Practice 2009. 5. 26. 16:30문제 요약 : 입력된 문자열에 포함된 문자가
문자열들의 집합에서 몇 번 사용되었는지 세어서 반환하라.
#include <iostream>
#include <vector>
using namespace std;
class ImageDithering
{
public:
int count(string dithered, vector <string> screen);
};
int ImageDithering::count(string dithered, vector <string> screen)
{
int cnt = 0;
for(int i = 0 ; dithered[i] ; i++)
for(int j = 0 ; j < screen.size() ; j++)
for(int k = 0 ; screen[j][k] ; k++)
if(dithered[i] == screen[j][k]) cnt++;
return cnt;
}
'Programming > SRM Practice' 카테고리의 다른 글
SRM 370 DIV 2 (250) (0) | 2009.05.26 |
---|---|
SRM 205 DIV 2 (250) (0) | 2009.05.26 |
SRM 200 DIV 2 (250) (0) | 2009.05.26 |
SRM 197 DIV 2 (250) (0) | 2009.05.26 |
SRM 144 DIV 2 (200) (0) | 2009.05.26 |