Algorithm with Problem Solving
#include <cstdio> inline int conv(int n){ return (n%10)*10+(n/10+n%10)%10; } int main(){ int N, len=1, cur; scanf("%d", &N); for(cur=conv(N); cur != N; ++len, cur=conv(cur)); printf("%d", len); return 0; }
댓글 쓰기
댓글 없음:
댓글 쓰기