ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1307. Archiver

Slava Shklyaev To admins: Go gets WA1, C++ gets AC [1] // Problem 1307. Archiver 29 Dec 2015 01:24
My solutions in the two languages produce the same output on my tests. However, the Go version gets WA1. Please fix this.
Ярбек Re: To admins: Go gets WA1, C++ gets AC // Problem 1307. Archiver 26 Oct 2017 09:09
#include<iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
int main()
{
    long  l;
    string a,b;
    cin>>a;
    l=a.length();
    if((l>=10)&&(l<=189))
    {
        b=a.substr(l-2,2);

    }
    else if((l>=190)&&(l<=2700))
    b=a.substr(l-3,3);
    else if((l<=2701)&&(l<=36000))
    b=a.substr(l-4,4);
    else
    b=a.substr(l-5,5);
    cout<<"//CPP"<<endl;
    cout<<"#include<iostream.h>"<<endl;
    cout<<"int main()"<<endl;
    int i = atoi(b.c_str());
    cout<<"{for(int i=1;i<"<<i+1<<";i++)cout<<i;return 0;}";
    return 0;
}