|
|
Common Board Edited by author 21.05.2017 17:19 See on one iteration of "for": let be x and y on start:x1 and y1. then after each change it'll be for x1 x2...x3; for y1 y2...y3; so you have to find out x3 and y3 through x and y on start(x1 and y1); Something like that x3=y1. Good luck and sorry if my English is not enough good for explaining it) 5 777 313 465 99 1 in the test above, how Daenerys can win ??? While we can divide: #Daenerys 777 -> 3 heaps (259) - 313 -> can't divide #Stannis 465 -> 3 heaps (155) #Daenerys 99 -> 3 heaps (33) #Stannis 33 -> 3 heaps (11) - 1 -> can't devide ==> Stannis is the winner 5 777 313 465 99 1 in the test above, how Daenerys can win ??? While we can divide: #Daenerys 777 -> 3 heaps (259) - 313 -> can't divide #Stannis 465 -> 3 heaps (155) #Daenerys 99 -> 3 heaps (33) #Stannis 33 -> 3 heaps (11) - 1 -> can't devide ==> Stannis is the winner 99 / 3 = 33 we put 33 3 times in array and can make a move and others too "313" can be divided into three heaps with odd number of nuts like this: "313 = 311 + 1 + 1" It doesn't have to equal number of nuts. +++ bad test I don't know how to use my program at this task I don't understand how the answer can be 15. Since the first 2 people got 0 correct predictions and the last person got 1 correct prediction, shouldn't the amount paid only be 5? First two people got more then 0 correct predictions because: "four sets of gold medals, four sets of silver medals, and four sets of bronze medals are awarded" dp[i][j] - represents number of staircases with i cubes and with the height of last block j. Answer is dp[n][1] + dp[n][2] + dp[n][3] ... dp[n][n]. can u help me with some algorithm better than dp(which works in O(n^2)) Edited by author 11.07.2016 03:57 At first check all tests with n<=4. If all of them cheked already then try to check all cells for n=8 (1/1; 1/2; 1/3; 1/4; 2/2; 2/3....)and for n=9. Don't be afraid you'll find your mistake on first tests)) Edited by author 10.07.2016 14:33 can someone give me some tips or tests? You can only use both modifiers once during whole process; you can't restock between "take" operations. For example, answer for test 4 208 100 208 100 is IMPOSSIBLE (at least according to my AC program): you can take 208, 100 by using deodorant on 208, but you can't do it twice. #include <iostream> #include <math.h> #include <iomanip> using namespace std; int main() { double a[100000]; int i, n; cin >>n; for (i=1; i<=n; ++i) { cin>>a[i]; } for (i=1; i<=n; ++i) { a[i] = sqrt(a[i]); } for (i=n; i>=1; --i) { cout << fixed << setprecision(4) << (a[i]) << endl; } } Прочитай внимательно графу исходные данные, у тебя первое число задаёт количество чисел которое ты будешь вводить, а там такого нету What is the criterion of optimality of the partition ? Minimum of maximum of 4 numbers, read problem Also, instead of «The i-th number in the j-th row» there should be «The j-th number in the i-th row» (unless, judging by the title, this is intended, haha) По условию может быть так(.-пробел):.........aaa.bbb.ссс. .....xxx.aaa.bbb.ccc. или .........aaa.bbb.ссс........ .....xxx.aaa.bbb.ccc........??????? И вообще,как в ЭТОЙ задаче считывать данные(на Паскале)? Edited by author 08.07.2016 21:27 Не может. В начале пробелов нет, между каждой группой ровно один пробел. Я делаю так: readln(s); i:=1; while i <= length(s) do begin //process [i], [i + 1], [i + 2] inc(i, 4); end; I tested my prog but I not found mistake Did you receive my email from a month ago? public class AB { public static void main(String [] args) { int a = 1; int b = 5; System.out.println((a+b)); } } В общем она требует ввод данных, а не определение переменных Edited by author 15.03.2016 20:58 Edited by author 15.03.2016 20:58 Тогда в чем проблема?))) public class Math{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int a = scanner.nextByte(); int b = scanner.nextByte(); System.out.print(a + b); } } import java.util.*; делал??? var m,n:word; i:word; begin readln(m,n); for i:=1 to n do begin write(i,' '); end; writeln; for i:=1 to m do begin write(i*n+1,' '); end; end. What test is wrong with it? Edited by author 07.07.2016 17:05 import re fl = re.compile('[+-]?[1234567890]*\.[1234567890]*([Ee][+-]?[1234567890]+)?') lf = re.compile('[+-]?[1234567890]+([Ee][+-]?[1234567890]+)?') nums = [] while True: first = input() if first == '#': break nums.append((first, int(input()))) for num in nums: num0 = num[0] if not (re.fullmatch(fl, num0) or re.fullmatch(lf, num0)): print('Not a floating point number') continue try: e_pos = num0.index('e') exp = int(num0[e_pos + 1:]) num0 = num0[:e_pos] except: try: e_pos = num0.index('E') exp = int(num0[e_pos + 1:]) num0 = num0[:e_pos] except: exp = 0 pm = num0[0] if pm in ['+', '-']: num0 = num0[1:] else: pm = '+' if pm == '+': pm = '' if exp > 0: num0 += '0' * exp elif exp < 0: num0 = '0' * (-exp) + num0 try: dot_pos = num0.index('.') except: dot_pos = len(num) num0 += '.' new_dot_pos = dot_pos + exp num0 = num0[:dot_pos] + num0[dot_pos + 1:] num0 = num0[:new_dot_pos] + '.' + num0[new_dot_pos:] while num0.startswith('0'): num0 = num0[1:] if num0.startswith('.'): num0 = '0' + num0 num0 += '0' * num[1] num0 = num0[:num0.index('.') + num[1] + 1] if num0.endswith('.'): num0 = num0[:-1] print(num0) My program (with error, I know where it is, but I will not write about it): import sys text = sys.stdin.readlines() text = ''.join(text) for symbol in ',;:-\n': text = text.replace(symbol, ' ') text = text.replace('!', '.').replace('?', '.') import re text = ' '.join(text.split()) text = text.replace('. ', '.') text = '.'.join(text.split('.')) text = text.replace(' .', '.') count = 0 for sentence in text.split('.'): if sentence != '': if sentence[0].islower(): count += 1 for word in sentence.split(): for letter in word[1:]: if letter.isupper(): count += 1 print(count) Edited by author 06.07.2016 19:17 I wrote 1009 and had AC, then I added long arifmetics, changing nothing and now I have WA#1. All test from 1009 are simmilar to 1012. What is test 1. Is it possible because of using stringstream out; out << k-1; mas[1] = out.str(); ? I did the same as you. Help us! Edited by author 05.07.2016 21:07 just need examples. I have no idea where is my mistake |
|
|