結果
| 問題 |
No.2460 #強調#
|
| コンテスト | |
| ユーザー |
nekoti
|
| 提出日時 | 2023-09-08 22:38:53 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 965 bytes |
| コンパイル時間 | 660 ms |
| コンパイル使用メモリ | 29,056 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 15:51:18 |
| 合計ジャッジ時間 | 883 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
#include<stdio.h>
#include<string.h>
//【find】
// 引数 :検索対象, 検索文字, n番目のhit(1はじまり)
// 戻り値:発見位置(0はじまり)
long long find(char* s, const char* find_string, int num/*1はじまり*/)
{
long long res_idx=-1;
long long find_len=strlen(find_string);
if(0==find_len)return -1;
char* p=s;
while(1){
p=strstr(p,find_string);
res_idx++;
if(NULL==p)break;
//printf("%d,%u,%u\n",res_idx,p,s);
if(num-1==res_idx)break;
const char* p2=p+find_len;
p+=find_len;
}
if(num-1!=res_idx)return -1;// 見つからなかった
if(0<=p-s)return p-s;
return -1;
}
int main(void)
{
int scan;//scanf警告用
int ans=0;
int i, j;
char s[101];//非配列用
scan=scanf("%s",s);//非配列用
int stidx, edidx;
stidx = find(s,"#",1);
edidx=find(&s[stidx+1], "#", 1);
s[stidx+edidx+1]=0;
// printf("%d %d\n", stidx,edidx);
printf("%s",&s[stidx+1]);
return 0;
}
nekoti