ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 2102. Миша и криптография

WA 32
Послано PO 24 дек 2018 11:21
Gents, apologies for posting the solution here, but I really need a pair of fresh eyes. Basically got WA 32 for python 3
```
import math

n = int(input())
rt = int(math.sqrt(n))

psum = 0

i = 2

while i <= rt and i <= 1500000:
    while n % i == 0:
        psum += 1
        n /= i

    i += 1

if psum == 20 and n == 1:
    print("Yes")
elif psum == 19 and n > 1:
    print("Yes")
else:
    print("No")

```

and scala 2.11
```
import java.io.{BufferedReader, InputStreamReader, StreamTokenizer}

object P2102 extends App {
  solve

  def solve: Unit = {
    new Solver2102().solve()
  }
}

class Solver2102 extends Reader2102 {

  def solve(): Unit = {
    val n = nextLong
    val yes = satisfies(n)

    val answer = if (yes) "Yes" else "No"
    println(answer)
  }

  def satisfies(n: Long): Boolean = {
    var sum = 0
    var cur = n
    val max = math.min(math.sqrt(n).asInstanceOf[Long], 15000000L)

    var i = 2
    while (i <= max) {
      while (cur % i == 0) {
        cur /= i
        sum += 1
      }
      i += 1
    }
    if (sum == 20 && cur == 1) true
    else if (sum == 19 && n > 1) true
    else false
  }
}

trait Reader2102 {
  val in = new StreamTokenizer(new BufferedReader(new InputStreamReader((System.in))))

  def nextLong: Long = {
    in.nextToken()
    in.nval.asInstanceOf[Long]
  }
}
```
but AC for c++
```
#include <cstdio>
#include <cmath>
using namespace std;


typedef long long LL;


int main()
{
    LL n;
    scanf("%lld", &n);

    int rt = sqrt(n), psum = 0;
    LL  curr = n;

    for(int i = 2; i <= rt and i <= 1500000; ++i) {
        while(curr % i == 0) {
            ++psum;
            curr /= i;
        }

    }

    if(psum == 20 && curr == 1)
        puts("Yes");
    else if (psum == 19 && curr > 1)
        puts("Yes");
    else
        puts("No");

    return 0;
}
```
and C#
```
using System;

class Program
{
    public static void Main(string[] args)
    {
        var n = Int64.Parse(Console.ReadLine());
        var sq = (Int64)Math.Sqrt(n);
        var limit = Math.Min(sq, 1500000);
        var psum = 0;

        for (int i = 2; i <= limit; i++) {
            while (n % i == 0) {
                n /= i;
                psum++;
            }
        }
        var answer = false;
        if (psum == 20 && n == 1) answer = true;
        else if (psum == 19 && n > 1) answer = true;

        Console.WriteLine(answer ? "Yes" : "No");
    }
}
```

why?? thanks in advance for help
Re: WA 32
Послано decay 24 дек 2018 14:01
del

Edited by author 24.12.2018 14:09