Ishtiaq11's blog

By Ishtiaq11, history, 5 years ago, In English

I have two integer b,n. I need to check if the number n is integer power of number b. For example: 100 is an integer power of 10. As 10^2 = 100. But 110 is not an integer power of 10. How to determine this in coding?

Read more »

 
 
 
 
  • Vote: I like it
  • -7
  • Vote: I do not like it

By Ishtiaq11, history, 5 years ago, In English

Given an array of n-2 unique numbers in range 1 to n (inclusive). I want to find the missing two numbers in the array using xor. Please help me providing the idea. Thanks in advance.

Read more »

Tags xor
 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

By Ishtiaq11, history, 5 years ago, In English

Getting Runtime Error on test case 11 for 791B - Bear and Friendship Condition. Please help me.

Code: 25707815 [Python 3]

Read more »

 
 
 
 
  • Vote: I like it
  • -6
  • Vote: I do not like it

By Ishtiaq11, history, 5 years ago, In English

If the amount of data is unknown, the following loop is useful in c++:

 while (cin >> x) {
 // code
 }

How to do this in Python?

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

By Ishtiaq11, history, 5 years ago, In English

I am a beginner in python. I've solved problems in some OJs with C++. Now i want to do it with Python 3. I started but i saw that my code wasn't not efficient. I got run time error or Time Limit. I faced problems taking input specially in UVa problems. Please help me.

Read more »

 
 
 
 
  • Vote: I like it
  • -14
  • Vote: I do not like it

By Ishtiaq11, history, 5 years ago, In English

Please help me to overcome time limit.

Problem Link: UVa 11340 Newspaper

My Code:

from sys import stdin,stdout
dd = dict()
tests = int(input().strip() )
for t in range(tests):
    dd.clear()
    sm = 0.0
    m = int(input().strip())
    for x in range(m):
        ch,vl = input().strip().split()
        dd[ch]=float(vl)
    for x in range(int(input())):
        line=input()
        for letter in line:
            if letter in dd:
                sm += dd[letter]
    print('%0.2f$' %(sm/100.0))

Read more »

 
 
 
 
  • Vote: I like it
  • -1
  • Vote: I do not like it

By Ishtiaq11, 7 years ago, In English
 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it