1 solutions
-
0
C :
#include <stdio.h> #include <string.h> int main() { int i,n,m,j; char a[110],b[110]; scanf("%d%d",&n,&m); getchar(); gets(a); for(i=m-1,j=0;i<n;i++,j++) b[j]=a[i]; b[j]='\0'; printf("%s\n",b); return 0; }C++ :
#include <stdio.h> #include <string.h> int main() { char str[101], newstr[101]; int n, m, i; scanf("%d %d", &n, &m); scanf("%s", str); for (i = m - 1;i < n;i++) newstr[i - (m - 1)] = str[i]; newstr[n - m + 1] = '\0'; printf("%s\n", newstr); return 0; }Pascal :
Program TK1288; var n,m:longint; s:string; Begin readln(n,m); readln(s); writeln(copy(s,m,n-m+1)); End.Java :
import java.util.Scanner; public class Main { private static Scanner s = new Scanner(System.in) ; public static void main(String[] args) { int n = s.nextInt() ; int m = s.nextInt() ; String str = s.next() ; System.out.println(str.substring(m-1)); } }
- 1
Information
- ID
- 17799
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By