C언어
#include<stdio.h>
int hansoo();
int main(){
int n=0,result=0;
scanf("%d",&n);
result = hansoo(n);
printf("%d",result);
return 0;
}
int hansoo(int n){
int gap1, gap2;
int count=0;
for(int i=1;i<=n;i++){
if(i<100){
count+=1;
}else if(i<1000){
gap1=(i/100)-((i%100)/10);
gap2=((i%100)/10)-((i%100)%10);
if(gap1==gap2) {
count+=1;
}
}
}
return count;
}
'알고리즘 > 백준' 카테고리의 다른 글
[백준_단계별로 풀어보기] 문자열 - 11720번 숫자의 합 | c언어 (0) | 2022.01.13 |
---|---|
[백준_단계별로 풀어보기] 문자열 - 11654번 아스키 코드 | c언어 (0) | 2022.01.13 |
[백준_단계별로 풀어보기]함수 - 4673번 셀프 넘버 | c언어 (0) | 2022.01.13 |
[백준_단계별로 풀어보기] 함수 - 15596번 정수 N개의 합 | c언어 (0) | 2022.01.11 |
[백준_단계별로 풀어보기] 배열 - 1546번 평균 | c언어 (0) | 2022.01.10 |