1 条题解
-
0
C :
#include<stdio.h> #include<stdlib.h> int main() { int n; char c[5]; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%s",&c); for(int j=3;j>=0;j--) printf("%c",c[j]); printf("\n"); } //system("pause"); return 0; }
C++ :
#include <cstdio> #include <cstring> int main() { //freopen("test.in", "r", stdin); //freopen("test.out", "w", stdout); int t; scanf("%d", &t); while (t--) { char s[10]; scanf("%s", s); int n = strlen(s); for (int i = n - 1; i >= 0; --i) putchar(s[i]); puts(""); } return 0; }
Pascal :
var s:ansistring; i,j,n:longint; begin readln(n); for i:=1 to n do begin readln(s); for j:=length(s) downto 1 do write(s[j]);writeln; end; end.
Java :
public class Main { public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in) ; int n =input.nextInt(); for(int j =0;j<n;j++){ String a = input.next(); int b = a.length()-1; for(int i=b;i>=0;i--){ String c= a.charAt(i)+""; System.out.print(c); } System.out.println(); } } }
Python :
#!/usr/bin/python def reverse1(string): return string[::-1] num=input() while num!=0: str1=raw_input() print(reverse1(str1)) num=num-1
- 1
信息
- ID
- 2078
- 时间
- 1000ms
- 内存
- 32MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者