The 8th Zhejiang Provincial Collegiate Programming ContestA - Ordinal Numbers

    技术2022-05-20  36

    返回目录

     

    代码:

    #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; inline int Rint() {int x; scanf("%d", &x); return x;} int x; void solve() { int t = (x/10); if(t == 1) { printf("%dth/n", x); } else { t = x; if(t == 1) printf("%dst/n", x); else if(t == 2) printf("%dnd/n", x); else if(t == 3) printf("%drd/n", x); else printf("%dth/n", x); } } int main() { int t = Rint(); while(t--) { x = Rint(); solve(); } }


    最新回复(0)