1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include<stdio.h> int main() { int t,n,x=0; scanf("%d",&t); while(t--) { scanf("%d",&n); for(int i=1;i<=n;i++) { if(i%3!=0) x+=1; } printf("%d\n",x%3); x=0; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include<stdio.h> int main() { int t,n,x=0; scanf("%d",&t); while(t--) { scanf("%d",&n); for(int i=1;i<=n;i++) { if(i%3!=0) x+=1; } printf("%d\n",x%3); x=0; } }