#AsuultSambar :

МОНГОЛ УЛС МАНДАН БАДРАГ!
It is currently Nov.21.17 9:05 pm

All times are UTC+09:00




Post new topic  Reply to topic  [ 240 posts ]  Go to page 1 2 3 4 510 Next
Author Message
PostPosted: Dec.03.05 8:41 pm 
Offline
Хvнд Гишvvн
Хvнд Гишvvн
User avatar

Joined: Jan.09.03 8:41 pm
Posts: 159
Location: оюун санаандаа
С хэлний хэдэн бодлого бодож өгч туслаач ...

1. Хоёр тоо өгөгджээ. 1 нь 2-оосоо их бөгөөд тэнцүү бол, 1 тоог нойллох, эсрэг тохиолдолд өөрчлөхгүй үлдээх програм зохио.

2. Өндөр настан (200-аас) дээш тэрний насны цифрүүдийн квадратуудын нийлбэр дээр түүний төрсөн өдрийг (1-31) нэмбэл түүний нас гэдгийг олжээ. Өндөр настны насыг олох програм зохио.

3. Өгсөн 3-н оронтой тооны хамгийн их утгатай цифрийг тодорхойлох алгоритм програм зохио.

4. А матрицыг хөрвүүлэх програм зохио. (Транспирование)

5. Хавтгай дээр ( X, Y )кординаттай n ширхэг цэг өгчээ. Эдгээр цэгүүдээс хоорондох зай нь хамгийн ойрхон байх хоёр цэгийг координатын хамт тодорхойлох програм зохио.


Анхаарал тавьсанд баярлалааа ... :wd:


Top
   
 Post subject:
PostPosted: Jan.06.06 12:48 pm 
Offline
Ахмад Гишvvн
Ахмад Гишvvн
User avatar

Joined: Dec.11.05 4:27 am
Posts: 571
Location: I am sorry for everything that i have done
bi sain medkuumaa sorry bro


Top
   
PostPosted: May.03.06 9:52 am 
Offline
Асуултын Архаг Мангас Гишvvн

Joined: May.02.06 8:53 pm
Posts: 3617
Location: Амьдрал үргэлж сайхнаараа
ene bol prime palindromiig hamgiin hurdnaar oloh bodlogo yumaa. 0.0005d amjih yostoi

_________________
.:TiMe QuAlIfIeS EvErYtHiNg:.


Top
   
 Post subject: hetsuu shuu
PostPosted: May.03.06 9:54 am 
Offline
Асуултын Архаг Мангас Гишvvн

Joined: May.02.06 8:53 pm
Posts: 3617
Location: Амьдрал үргэлж сайхнаараа
The number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime palindromes in the range of two supplied numbers a and b (5 <= a < b <= 100,000,000); both a and b are considered to be within the range .

PROGRAM NAME: pprime
INPUT FORMAT
Line 1: Two integers, a and b

SAMPLE INPUT (file pprime.in)
5 500

OUTPUT FORMAT
The list of palindromic primes in numerical order, one per line.
SAMPLE OUTPUT (file pprime.out)
5
7
11
101
131
151
181
191
313
353
373
383

_________________
.:TiMe QuAlIfIeS EvErYtHiNg:.


Top
   
 Post subject:
PostPosted: May.03.06 10:28 am 
Offline
Асуулт Самбарын Хvндэт Харуул
User avatar

Joined: Dec.19.05 5:18 pm
Posts: 6131
Location: Стэмфорд Бридж
,,,


Last edited by Капитан on Oct.19.11 5:12 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: May.03.06 6:57 pm 
Offline
Асуултын Архаг Мангас Гишvvн

Joined: May.02.06 8:53 pm
Posts: 3617
Location: Амьдрал үргэлж сайхнаараа
bolnoo gehdee gol ni hugatsaa sh dee bodood ogvol bayarlana shuu

_________________
.:TiMe QuAlIfIeS EvErYtHiNg:.


Top
   
 Post subject:
PostPosted: May.06.06 1:16 pm 
Offline
Тvмэн Эх Гишvvн
Тvмэн Эх Гишvvн

Joined: Aug.22.05 9:22 am
Posts: 92

Here is my solution in C#. I think it is kinda efficient algorithm but not as good as mentioned in the requirement though :wink:



#region using directives

using System;
using System.Collections;

#endregion

namespace PrimeAndPalindrome
{
/// <summary>
/// prime and palindrome
/// used factorisation to compute prime numbers
/// author: tgn (member of asuult.net) May 06 2006 :-).
/// </summary>

class PPTest
{

static void Main(string[] args)
{
isPalindromeAndPrime(5,100000);
}

public static bool isPalindrome(string str)
{
int start, end = str.Length-1;

for(start=0; start<end; start++, end--)
{
if(str[start]!=str[end])
return false;
}

return true;
}


public static void isPalindromeAndPrime(int a, int b)
{
int sqrt_b = (int) Math.Sqrt(b);
BitArray primes = new BitArray(b, true);

for(int n = 2; n < sqrt_b; n++)
{
if(primes[n])
{
for (int i = n*n; i < b; i += n)
primes[i] = false;
}
}

int countPrimes = 0;
DateTime startDT = DateTime.Now;

for(int i = a; i < b; i++)
if(primes[i])
{
if(isPalindrome(i.ToString()))
{
countPrimes++;
Console.WriteLine(i);
}
}

Console.Write("\nRuntime:");
Console.WriteLine(startDT-DateTime.Now);
Console.WriteLine(countPrimes + " out of " + b + " prime and palindrome numbers found.");
Console.ReadLine();
}

}
}


Top
   
 Post subject:
PostPosted: May.09.06 1:17 pm 
Offline
Ахмад Гишvvн
Ахмад Гишvvн
User avatar

Joined: Aug.07.03 9:53 pm
Posts: 566
Location: Менх тэнгэрийн хvчин дор
1000000000 hutel hooson tsikl guilgehed 4/10000 secunded amjih yum bol uu ?

#include <stdio.h>

unsigned long far * timer = (unsigned long far *) 0x0000046c ;
unsigned long savedTime , runTime ;

void main ()
{
savedTime = * timer ;
for (unsigned long i = 0 ; i < 1000000000 ; i ++) ;

runTime = * timer - savedTime ;

printf ("%ld\n" , runTime) ;
}

ajilluulhad 181 gej hevlej bna,

181/18.2 geheer oiroltsoogoor 10sec bolj bna.

500000000

tsikl guilgehed 94 gej garj bna. teheer bodlogiinhoo hyazgaarlaltiig dahin harah heregtei yum shig bna. :-)

_________________
FUKDEMCHINESE :snipersmilie:


Top
   
 Post subject:
PostPosted: May.09.06 6:45 pm 
Offline
Хэлээд баршгvй их цолтой
Хэлээд баршгvй их цолтой

Joined: Mar.31.03 4:10 pm
Posts: 454
Bi hamgiin hurdan argiig bichye. O(1) shuu. :P

long A[C];
scan(a, b);
pos_start= binarySearch(a, 0, C-1);
pos_end= binarySearch(b, pos_start, C-1);
for (i= pos_start; i++; i<= pos_end) {
print(A[i]);
}
//where: A[C] is an ordered array of PREGENERATED values of prime and palindrome #s
100,000,000 dotor iim nohtsoliig hangah too tsoohon bgaa.
Erembelegdsen uchraas ehnii bairlaliig olood suulchiin bairlaliig olood ter hoorondohiig hevlehed hangalttai. :P 0.0005-g hangah hamgiin dohomtei arga bh gej naidaj bna.


Top
   
 Post subject:
PostPosted: May.10.06 11:47 am 
Offline
Асуултын Архаг Мангас Гишvvн

Joined: May.02.06 8:53 pm
Posts: 3617
Location: Амьдрал үргэлж сайхнаараа
Thanks all

_________________
.:TiMe QuAlIfIeS EvErYtHiNg:.


Top
   
 Post subject:
PostPosted: May.10.06 8:59 pm 
Offline
Өвөг Дээдсийн Сахиус Гишvvн
Өвөг Дээдсийн Сахиус Гишvvн
User avatar

Joined: Dec.30.02 10:46 pm
Posts: 744
1.Orongiin too ni zovhon sondgoi baina. Uchir ni tegsh orontoi palindrome too urgelj 11-t huvaagdah uchir anhnii too bish. Zovhon sondgoi orontoi toonuudiin huvid hiigeerei.
2. ehleed palindrome too esehiig shalgaad daraa ni prime gedgiig ni shalga. Uchir ni palindrome too oloh ni O (m) m- orongiin too. Prime mon esehiig shalgah ni O (sqrt(n)) n- shalgaj bui too.

ene 2 optimization hiisen baihad tsagtaa gartsaagui amjih bolno.

_________________
Work hard, play hard!


Top
   
 Post subject:
PostPosted: May.19.06 8:22 pm 
Offline
Асуултын Архаг Мангас Гишvvн

Joined: May.02.06 8:53 pm
Posts: 3617
Location: Амьдрал үргэлж сайхнаараа
black morgan wrote:
1.Orongiin too ni zovhon sondgoi baina. Uchir ni tegsh orontoi palindrome too urgelj 11-t huvaagdah uchir anhnii too bish. Zovhon sondgoi orontoi toonuudiin huvid hiigeerei.
2. ehleed palindrome too esehiig shalgaad daraa ni prime gedgiig ni shalga. Uchir ni palindrome too oloh ni O (m) m- orongiin too. Prime mon esehiig shalgah ni O (sqrt(n)) n- shalgaj bui too.

ene 2 optimization hiisen baihad tsagtaa gartsaagui amjih bolno.

Thanks gehdee bolohgui ee

_________________
.:TiMe QuAlIfIeS EvErYtHiNg:.


Top
   
 Post subject:
PostPosted: May.19.06 10:05 pm 
Offline
Өвөг Дээдсийн Сахиус Гишvvн
Өвөг Дээдсийн Сахиус Гишvvн
User avatar

Joined: Dec.30.02 10:46 pm
Posts: 744
concuest wrote:
black morgan wrote:
1.Orongiin too ni zovhon sondgoi baina. Uchir ni tegsh orontoi palindrome too urgelj 11-t huvaagdah uchir anhnii too bish. Zovhon sondgoi orontoi toonuudiin huvid hiigeerei.
2. ehleed palindrome too esehiig shalgaad daraa ni prime gedgiig ni shalga. Uchir ni palindrome too oloh ni O (m) m- orongiin too. Prime mon esehiig shalgah ni O (sqrt(n)) n- shalgaj bui too.

ene 2 optimization hiisen baihad tsagtaa gartsaagui amjih bolno.

Thanks gehdee bolohgui ee

Naad bodlogo chini USACO-giinh biz dee... Naadahiig chini tsagt ni amjuulaad submit hiisen hun shuu.

_________________
Work hard, play hard!


Top
   
 Post subject:
PostPosted: May.20.06 3:28 am 
Offline
Эрчлэх Сумны Исгэрээ Гишvvн
Эрчлэх Сумны Исгэрээ Гишvvн
User avatar

Joined: Feb.23.06 8:12 pm
Posts: 211
Location: UB
Hamgiin hurdan arga gej bodoj bna!!!
#include <string.h>
#include <conio.h>
#include <iostream.h>
#include <stdlib.h>
long Strrev(char *a)
{
strrev(a);
return atol(a);
}
main()
{
long n,m;
char *val;
cin>>n>>m;
for(int i=n;i<=m;i++)
{
ltoa(i,val,10);
if(i==Strrev(val)) cout<<i<<" ";
}
getch();
}

_________________
Сайхаан сайхан.....


Top
   
 Post subject:
PostPosted: May.31.06 6:08 pm 
Offline
Тvмэн Эх Гишvvн
Тvмэн Эх Гишvvн
User avatar

Joined: Jun.30.05 4:53 pm
Posts: 94
Location: Bainga end...
TA BUHEND NEG SANAL TAVIJ BAINA SUDLAJ UZEEREI http://forum.orkhon.net/viewtopic.php?p=118019#118019


Top
   
 Post subject:
PostPosted: Jun.04.06 8:47 pm 
Offline
Асуултын Архаг Мангас Гишvvн

Joined: May.02.06 8:53 pm
Posts: 3617
Location: Амьдрал үргэлж сайхнаараа
wow really thanks

_________________
.:TiMe QuAlIfIeS EvErYtHiNg:.


Top
   
 Post subject:
PostPosted: Jun.04.06 9:37 pm 
Offline
Ноёлогч Гишvvн
Ноёлогч Гишvvн
User avatar

Joined: May.01.06 3:54 pm
Posts: 1012
Location: utastaigaa zuuraldaad l suuj bn
HE HE BODOJ DUUSSAN UU?

_________________
http://gantsaaraa.hi5.com


Top
   
 Post subject:
PostPosted: Jun.05.06 11:00 pm 
Offline
Асуултын Архаг Мангас Гишvvн

Joined: May.02.06 8:53 pm
Posts: 3617
Location: Амьдрал үргэлж сайхнаараа
gantsaaraa_t wrote:
HE HE BODOJ DUUSSAN UU?
Harin l dee. Gehdee minii bodloor neg bodlogiig bodoj duusna gej bdag yumuu? neg bodlogiig olon yanziin argaar bodoj boldog sh dee. Gantshan argaar ni bodsoniigoo bodoj duussan gej bolohgui sh dee. Yadaj l olon hel deer bichij bolno sh dee. Heheh

_________________
.:TiMe QuAlIfIeS EvErYtHiNg:.


Top
   
 Post subject:
PostPosted: Jun.07.06 8:08 pm 
Offline
Хэлээд баршгvй их цолтой
Хэлээд баршгvй их цолтой

Joined: Mar.31.03 4:10 pm
Posts: 454
concuest wrote:
gantsaaraa_t wrote:
HE HE BODOJ DUUSSAN UU?
Harin l dee. Gehdee minii bodloor neg bodlogiig bodoj duusna gej bdag yumuu? neg bodlogiig olon yanziin argaar bodoj boldog sh dee. Gantshan argaar ni bodsoniigoo bodoj duussan gej bolohgui sh dee. Yadaj l olon hel deer bichij bolno sh dee. Heheh

1 argaar bodood Time limitee barij bval bolooshte

_________________
http://neu2st.blogspot.com


Top
   
 Post subject:
PostPosted: Jun.08.06 9:11 pm 
Offline
Tesseract Club Member
User avatar

Joined: Aug.23.05 8:06 pm
Posts: 2960
Location: АСУУЛТ.net
concuest wrote:
black morgan wrote:
1.Orongiin too ni zovhon sondgoi baina. Uchir ni tegsh orontoi palindrome too urgelj 11-t huvaagdah uchir anhnii too bish. Zovhon sondgoi orontoi toonuudiin huvid hiigeerei.
2. ehleed palindrome too esehiig shalgaad daraa ni prime gedgiig ni shalga. Uchir ni palindrome too oloh ni O (m) m- orongiin too. Prime mon esehiig shalgah ni O (sqrt(n)) n- shalgaj bui too.

ene 2 optimization hiisen baihad tsagtaa gartsaagui amjih bolno.

Thanks gehdee bolohgui ee


Болдог л юмдаа. Мэдээж палиндромоо үүсгэж л явна ш дээ. Оронгийн хагас оронг нь үүсгээд хойно нь нугалж тавиад. Тэгээд эхний тоо нь сондгой бас 5 байж болохгүй эд нар. black morgan наад training чинь дуусгачихсан хүн шүү

_________________
B4 FB, JB was cool, ASUULT.Net


Top
   
 Post subject:
PostPosted: Jun.22.06 4:00 pm 
Offline
Ургах Нарны Улаан Цацраг
Ургах Нарны Улаан Цацраг
User avatar

Joined: Dec.05.04 10:34 pm
Posts: 261
Наад бодлого чинь Usaco ийн бодлого л байна шдээ Bla morgan ийн зөв гэж бодож байна


Top
   
 Post subject:
PostPosted: Jun.22.06 9:44 pm 
Offline
Tesseract Club Member
User avatar

Joined: Aug.23.05 8:06 pm
Posts: 2960
Location: АСУУЛТ.net
Өөрөө хаана сурдаг вэ? USACO-г хэр явуулсан

_________________
B4 FB, JB was cool, ASUULT.Net


Top
   
 Post subject:
PostPosted: Jun.23.06 5:09 pm 
Offline
Ургах Нарны Улаан Цацраг
Ургах Нарны Улаан Цацраг
User avatar

Joined: Dec.05.04 10:34 pm
Posts: 261
5 дугаар бүлэг эхэлж байгаа


Top
   
 Post subject:
PostPosted: Jun.25.06 2:27 pm 
Offline
Tesseract Club Member
User avatar

Joined: Aug.23.05 8:06 pm
Posts: 2960
Location: АСУУЛТ.net
Soedoombi wrote:
5 дугаар бүлэг эхэлж байгаа


Хулхидаагүй 5 хүргэсэн бол аймар л бодож байгаа юм байна :wd:

_________________
B4 FB, JB was cool, ASUULT.Net


Top
   
 Post subject:
PostPosted: Jun.25.06 10:50 pm 
Offline
Өвөг Дээдсийн Сахиус Гишvvн
Өвөг Дээдсийн Сахиус Гишvvн
User avatar

Joined: Dec.30.02 10:46 pm
Posts: 744
Dexter Soedoombi 2 barag 1 oroonoos naad sedevdee orj baih shig bna. Ingevel oilgomjtoi biz dee.

_________________
Work hard, play hard!


Top
   
 Post subject:
PostPosted: Jun.25.06 11:49 pm 
Offline
¤ Expert
User avatar

Joined: Apr.13.02 9:20 pm
Posts: 6224
Location: Henti aimgiin Galshar sumiin uyach Bazarwaaniin gert
USACO gej nom uu?

Skienna, Revilla nariin "Programming Challenges" gedeg nom her ve?

_________________
http://t8m8r.wordpress.com


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 240 posts ]  Go to page 1 2 3 4 510 Next

All times are UTC+09:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Copyright Asuult.NET © 2000-2015.
Administrative Contact: Khundaga Khurelbaatar [hundaga@hotmail.com]
Tel: 1-888-303-4927, Fax: 1-888-406-2264.
Powered by phpBB © 2000-2015 phpBB Group. Powered by phpBB® Forum Software © phpBB Limited