답안 #22840

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
22840 2017-04-30T07:50:10 Z 크리콘 B번 문제는 그리디로 풀려요(#918, imsifile) New Ocurrences (KRIII5_NO) C++
0 / 7
16 ms 100832 KB
#include<stdio.h>
#include<string.h>

char st[101010]; int N;
int dy[5050][5050]; long long sum;

int main(){
	gets(st+1); N=strlen(st+1);
	for(int i=1; i<=N; i++){
		for(int j=1; j<i; j++){
			if(st[i]==st[j])dy[i][j] = 1+dy[i-1][j-1];
		}
	}
	for(int i=1; i<=N; i++){
		for(int j=1; j<i; j++)sum += dy[i][j]*2;
		sum += i;
		printf("%lld\n", sum);
	}
	return 0;
}

Compilation message

NO.cpp: In function 'int main()':
NO.cpp:8:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(st+1); N=strlen(st+1);
  ^
In file included from NO.cpp:1:0:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
NO.cpp:8:2: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(st+1); N=strlen(st+1);
  ^
In file included from NO.cpp:1:0:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
NO.cpp:8:11: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(st+1); N=strlen(st+1);
           ^
In file included from NO.cpp:1:0:
/usr/include/stdio.h:638:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^
NO.cpp:8:12: warning: ignoring return value of 'char* gets(char*)', declared with attribute warn_unused_result [-Wunused-result]
  gets(st+1); N=strlen(st+1);
            ^
/tmp/cchGD3CH.o: In function `main':
NO.cpp:(.text.startup+0x10): warning: the `gets' function is dangerous and should not be used.
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 100832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 16 ms 100832 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -