結果

問題 No.528 10^9と10^9+7と回文
ユーザー WA_TLEWA_TLE
提出日時 2017-06-09 23:31:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,157 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 98,456 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 02:22:51
合計ジャッジ時間 1,979 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 5 ms
4,348 KB
testcase_12 AC 5 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 3 ms
4,348 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 3 ms
4,348 KB
testcase_20 WA -
testcase_21 AC 3 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 5 ms
4,348 KB
testcase_27 AC 4 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
using namespace std;
typedef long long int llint;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=1000000007;
const llint moda=1000000000;
const llint big=1e9+1e8;
const llint red=0xE869120;
const llint pro=1002001;
int main(void){
	string str;
	llint ans=0,ansa=0,i,j,n,gen,geng;
	cin>>str;n=str.size();
	if(str[0]==0){while(-1){}}
	str[0]--;
	gen=9;geng=9;
	for(i=1;i<n;i++){
		ans+=gen;ans%=mod;
		ansa+=geng;ansa%=moda;
		if(i%2==0){gen*=10;gen%=mod;geng*=10;geng%=moda;}
	}
	gen=0;geng=0;
	for(i=0;i<(n+1)/2;i++){
		gen*=10;gen+=str[i]-'0';gen%=mod;
		geng*=10;geng+=str[i]-'0';geng%=moda;
	}ans+=gen;ansa+=geng;ans++;ansa++;
	str[0]++;
	for(i=0;i<n/2;i++){
		if(str[i]>str[n-i-1]){ans--;ansa--;break;}
		if(str[i]<str[n-i-1]){break;}
	}
	ans%=mod;ansa%=moda;
	cout<<ansa<<endl;
	cout<<ans<<endl;
	return 0;
}
0