結果
問題 | No.491 10^9+1と回文 |
ユーザー |
|
提出日時 | 2017-04-08 23:48:01 |
言語 | C++11 (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,107 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 25,472 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-07-17 23:57:44 |
合計ジャッジ時間 | 3,181 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 102 |
ソースコード
#include <stdio.h> #include <stdlib.h> #include <string.h> #define READ_BUFSIZE ( 128 ) #define READ_DELIMITER ( " " ) //標準入力取得(1行) int GetStdin( char* pszStr, int lMaxLen ) { int lLen = 0; memset( pszStr, 0, lMaxLen ); if( fgets( pszStr, lMaxLen, stdin ) ) { lLen = strlen( pszStr ); if( lLen >= 1 ) { if( pszStr[ lLen - 1 ] == 0x0A ) { pszStr[ lLen - 1 ] = 0; lLen--; } } } return( lLen ); } int main(int argc, char *argv[]) { char szRead[READ_BUFSIZE] = ""; //char* psOutbuf[10000] = { 0 }; int lInput[4] = {0}; GetStdin( szRead, READ_BUFSIZE ); long long int base = 1000000001; long long int max = strtoull( szRead, 0, 0 ); //long long int max = strtoul( szRead, 0, 0 ); long long int x = 0; char a[READ_BUFSIZE] = ""; int count = 0; for( int i = 1; base*i <= max; i++ ) { sprintf( a, "%lld", base*i ); int len = strlen( a ); int j = 0; for( ; j < len / 2; j++ ) { if( a[j] != a[len-j-1] ) break; } if( j == len / 2 ) count++; } printf( "%d\n", count ); return 0; }