#include <stdio.h>
//練習問題E
int tri(int n){
if(n==0) return 0;
else if(n==1) return 0;
else if(n==2) return 1;
else return tri(n-1)+tri(n-2)+tri(n-3);
}
int main(void) {
int n = 7;
printf("数列Tnについて, n=%dのときの値は%d\n", n
, tri
(n
)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Ci8v57e057+S5ZWP6aGMRQppbnQgdHJpKGludCBuKXsKCWlmKG49PTApIHJldHVybiAwOwoJZWxzZSBpZihuPT0xKSByZXR1cm4gMDsKCWVsc2UgaWYobj09MikgcmV0dXJuIDE7CgllbHNlIHJldHVybiB0cmkobi0xKSt0cmkobi0yKSt0cmkobi0zKTsKfQoKCgoKaW50IG1haW4odm9pZCkgewoJaW50IG4gPSA3OwogICAgcHJpbnRmKCLmlbDliJdUbuOBq+OBpOOBhOOBpiwgbj0lZOOBruOBqOOBjeOBruWApOOBryVkXG4iLCBuLCB0cmkobikpOwoJcmV0dXJuIDA7Cn0K