반응형
#include <stdio.h>
int main() // int main()
{ // {
int n, m, cnt=0; // int n, m, 카운터=0;
//
scanf("%d %d", &n, &m); // (m, n)에입력숫자를저장하라;
//
while(m > 0) // (m > 0)한동안
{ // {
if(n == m%100) // 만약(n 이 m의 마지막두자리와 같다)면
cnt++; // 카운터++;
m/=10; // m의 마지막자리수를 날린다;
} // }
printf("%d", cnt); // printf("%d", cnt);
//
return 0; // return 0;
} // }
문제는
The Numbers매우 심심한 문제.Write a program to report the number of times a number N appears in another number M. The number N is between 10 and 99, and the number M is between 1000000 and 9999999, inclusively.
728x90
'프로그래밍 > 미분류' 카테고리의 다른 글
| [복잡] (0) | 2008.12.05 |
|---|---|
| 비트 인버트는 선형적인가? (0) | 2008.11.27 |
| [CPP|MFC] 감마보정 데모 (0) | 2008.08.15 |
| [Py|수치해석] 무식하게 DFT (0) | 2008.08.14 |
| [CPP|MFC] 초간단 Blob 효과 (0) | 2008.05.13 |