Submission #617734


Source Code Expand

#include <iostream>
#include <string>

bool is2525(std::string str)
{
    if ((str[0] == '2' && str[str.length()] == '5'))
    {
        return false;
    }

    for (int c = 0, max = str.length(); c < max; ++c)
    {
        if (!(str[c] == '2' || str[c] == '5'))
        {
            return false;
        }
    }

    return true;
}

int main(void)
{
    int n;
    std::cin >> n;

    int count = 0;
    for (int i = 25; i < n; ++i)
    {
        if(is2525(std::to_string(i)) == true)
        {
            ++count;
        }
    }

    std::cout << count << std::endl;

    return 0;
}

Submission Info

Submission Time
Task A - ニコニコ数
User tiwa0x00
Language C++ (GCC 4.9.2)
Score 0
Code Size 629 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:30:19: error: ‘to_string’ is not a member of ‘std’
         if(is2525(std::to_string(i)) == true)
                   ^