Submission #143976


Source Code Expand

Copy
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <tuple>
#include <set>
#include <string.h>

#define X first
#define Y second
#define MP make_pair
#define MT make_tuple
#define FOR(i, n) for(int (i) = 0; (i) < (n); (i)++)
typedef long long ll;
using namespace std;
const int MAX = 101;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

int main(){
	string n;
	cin >> n;

	if (n.size() == 1){
		cout << 0 << endl;
		return 0;
	}

	int ans = 0;
	int h = n.size() / 2;
	int idx = 1;
	for (; idx <= h; idx++){
		ans += 48;
		if (n.size() % 2){
			if (n[h + idx] != n[h - idx]){
				ans += 25;
				break;
			}
			else ans += 2;
		}else{
			if (n[h + (idx - 1)] != n[h - idx]){
				break;
			}
			else ans += 2;
		}
	}
	if (h>idx) ans += (h - idx) * 50;

	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task B - こだわりの名前
User keny30827
Language C++11 (GCC 4.8.1)
Score 0
Code Size 1088 Byte
Status
Exec Time 42 ms
Memory 1444 KB

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 100 hand_1.txt, hand_2.txt, hand_3.txt, hand_4.txt, hand_5.txt, hand_6.txt, palindrome_1.txt, palindrome_12345.txt, palindrome_2.txt, palindrome_299998.txt, palindrome_299999.txt, palindrome_3.txt, palindrome_300000.txt, palindrome_4.txt, palindrome_5.txt, palindrome_6789.txt, palindrome_67890.txt, palindrome_mod_1.txt, palindrome_mod_1000.txt, palindrome_mod_10000.txt, palindrome_mod_100001.txt, palindrome_mod_2.txt, palindrome_mod_200000.txt, palindrome_mod_299999.txt, palindrome_mod_3.txt, palindrome_mod_300000.txt, palindrome_mod_4.txt, palindrome_mod_5.txt, palindrome_mod_50001.txt, random_1.txt, random_10.txt, random_100001.txt, random_101.txt, random_3000.txt, random_300000.txt, random_50001.txt
Case Name Status Exec Time Memory
hand_1.txt 36 ms 1324 KB
hand_2.txt 37 ms 1324 KB
hand_3.txt 42 ms 1328 KB
hand_4.txt 38 ms 1432 KB
hand_5.txt 36 ms 1316 KB
hand_6.txt 37 ms 1320 KB
palindrome_1.txt 22 ms 796 KB
palindrome_12345.txt 21 ms 920 KB
palindrome_2.txt 21 ms 920 KB
palindrome_299998.txt 35 ms 1324 KB
palindrome_299999.txt 39 ms 1328 KB
palindrome_3.txt 23 ms 796 KB
palindrome_300000.txt 37 ms 1436 KB
palindrome_4.txt 22 ms 796 KB
palindrome_5.txt 22 ms 804 KB
palindrome_6789.txt 21 ms 916 KB
palindrome_67890.txt 26 ms 936 KB
palindrome_mod_1.txt 22 ms 924 KB
palindrome_mod_1000.txt 22 ms 912 KB
palindrome_mod_10000.txt 23 ms 788 KB
palindrome_mod_100001.txt 27 ms 940 KB
palindrome_mod_2.txt 19 ms 916 KB
palindrome_mod_200000.txt 31 ms 1068 KB
palindrome_mod_299999.txt 38 ms 1444 KB
palindrome_mod_3.txt 24 ms 792 KB
palindrome_mod_300000.txt 37 ms 1324 KB
palindrome_mod_4.txt 23 ms 808 KB
palindrome_mod_5.txt 22 ms 920 KB
palindrome_mod_50001.txt 24 ms 924 KB
random_1.txt 24 ms 796 KB
random_10.txt 20 ms 920 KB
random_100001.txt 32 ms 1136 KB
random_101.txt 22 ms 796 KB
random_3000.txt 22 ms 912 KB
random_300000.txt 36 ms 1324 KB
random_50001.txt 25 ms 932 KB
sample_1.txt 22 ms 804 KB
sample_2.txt 23 ms 796 KB
sample_3.txt 22 ms 840 KB