Sicily 1510欢迎提出优化方案

这道题我觉得是除1000(A-B)外最简单的题了……不过还是提出一个小问题:在本机用gcc编译的时候我没包括string.h头文件,通过编译,为什么在sicily上却编译失败?

1510. Mispelling

限制条件

时间限制: 1 秒, 内存限制: 32 兆

题目描述

Misspelling is an art form that students seem to excel at. Write a program that removes the n <tex2html_verbatim_mark>th character from an input string.

输入格式

 

The first line of input contains a single integer N <tex2html_verbatim_mark>, (1≤N≤1000) <tex2html_verbatim_mark>which is the number of datasets that follow.

Each dataset consists of a single line of input containing M <tex2html_verbatim_mark>, a space, and a single word made up of uppercase letters only. M <tex2html_verbatim_mark>will be less than or equal to the length of the word. The length of the word is guaranteed to be less than or equal to 80.

 

输出格式

For each dataset, you should generate one line of output with the following values: The dataset number as a decimal integer (start counting at one), a space, and the misspelled word. The misspelled word is the input word with the indicated character deleted.

样例输入

4 

4 MISSPELL 

1 PROGRAMMING 

7 CONTEST 

3 BALLOON

样例输出

1 MISPELL 

2 ROGRAMMING 

3 CONTES 

4 BALOON

题目来源

Greater New York 2007

#include<stdio.h>

//#include<string.h>

int main()

{

  int N,count=1;

  scanf("%d",&N);

  while(N--){

     int M,i;

     char str[80];

     scanf("%d %s",&M,str);

     int len=strlen(str);

     for(i=M-1;i<len;i++) str[i]=str[i+1];

     str[len]='\0';

     printf("%d %s\n",count,str);

     count++;

  }

  return 0;

}

 

 

你可能感兴趣的:(优化)