#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int solution(int n) {
int answer = 0;
while(n>0){
answer += n %10;
n/=10;
}
return answer;
}
풀이:
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int solution(int n)
{
int answer = 0;
for(int i=1; i<= n/2; i++)
{
if(n % i == 0)
{
answer +=i;
}
}
return answer+n;
}
SELECT name
from animal_ins
ORDER BY DATETIME asc
limit 1
SELECT DATETIME
from animal_ins
ORDER BY DATETIME asc
limit 1
SELECT ANIMAL_ID, NAME
from animal_ins
WHERE INTAKE_CONDITION !='Aged'
ORDER BY ANIMAL_ID asc
근데 알고리즘보다 SQL이 더 직관적이고 쉬운듯하다...