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

Обсуждение задачи 1049. Отважные воздухоплаватели

See my solution (- AC 0.015-245 KB) !
Послано Gerasim Petrov Velchev 24 июл 2008 14:35
My solution is very intelligent!
After every read number, we make factorization of it.
Every number is smaller than 10000.
We have array fact with 10000 elements and this array is global, because every elements are zero when we declare it.
When we make factorization of every divisor p (for factorization), we increase the p-th element in the array.
In the end of reading in array fact we have how many times is used i-th element in factorization - we have factorization of the whole product.
With one looking the array we calculate the amount of divisors with the so famous formula:
N=p[1]k[1]*p[2]k[2]*p[3]*k[3]*..., when p[i] is prime number , k[i] is amount of p[i] in factorization of N.
The amount of divisors is:(k[1]+1)*(k[2]+1)*(k[3]+1)*... .
See it!
//Brave-balloonists
#include<iostream>
using namespace std;
int fact[10000];
int main () {
int a;
for (int i=0;i<10;i++) {
int a;
cin>>a;
if (a!=1)
   {
int p=1,st=1;
while (a!=1)           {
p+=st;
while (a%p==0) {
a/=p;
fact[p]++;
               }
if (p==2) {p=1;st=2;}
                       }
  }
}
int br_del=1;
for (int i=0;i<10000;i++) br_del*=(fact[i]+1);
printf("%d\n",br_del%10);
return 0;
}
Re: See my solution (- AC 0.015-245 KB) !
Послано AnyoneNeedingHelp 31 окт 2008 12:23
you must delete it.