| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Язык(Фортран) | craft1k | | 6 июн 2015 14:25 | 1 |
Есть ли возможность сдавать задачи на языке Фортран |
| The problem description is very unclear: here is a clarification | Otrebus | 1121. Филиалы | 5 июн 2015 16:23 | 1 |
Each crossroads in the input is the binary OR of its branches, so a 5 (binary 101) at some crossroads in the input means there are branches 4 (100) and 1 (001) there. As for the output, for each crossroads where there are no branches (each 0, let's call this crossroads P), repeat this: Find the Manhattan (vertical+horizontal) distance to the closest branch from C. In the description, this closest distance is 2. Next, find all branches that lie on this exact distance from C. In the description, these are branches with number 16, 8, and 4. The output at location P should reflect all types of branches at distance 2 by ORing these numbers together, and in the description we get 28 (binary 10000 | 1000 | 100). |
| What Wrong? | WEE YING KIT | 1068. Сумма | 5 июн 2015 15:13 | 1 |
import java.util.Scanner; import java.io.*; public class HelloWorld { public static void main(String args[]) {
int a = 0; int total = 0; Scanner input = new Scanner(System.in); a = input.nextInt(); total = convertFunc(a); System.out.println(total); }
public static int convertFunc(int n){
int sum = 0; if(n > 0 && n <= 10000 ) { for(int i = 1 ; i <= n ; i++ ) { sum += i; } } else { for(int i = 1 ; i >= n ; i--) { sum += i; } } return sum; } } |
| 1001. Обратный корень(Wrong answer) Java | Сергей | 1001. Обратный корень | 5 июн 2015 12:49 | 2 |
import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.ArrayList; import java.util.Scanner; public class Task1001 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); ArrayList<Long> list = new ArrayList<Long>(); for (int i = 0; i < 4 ; i++) { long a = scanner.nextLong(); if (a >= 0 && a <= 10E18) list.add(a); } DecimalFormatSymbols symbol = new DecimalFormatSymbols(); symbol.setDecimalSeparator('.'); DecimalFormat f = new DecimalFormat("#,##0.0000", symbol); for (int i = list.size(); i > 0 ; i--) { double c = (Math.sqrt(list.get(i - 1))); System.out.println((f.format(c))); } } } I need help please!!! Edited by author 04.04.2015 17:02 Well, maybe because you are checking it only for 4 Long values, It's working only for 4 exact values, not less, not more. Edited by author 05.06.2015 13:04 |
| Don't understand 1316 | danil123 | 1316. Биржа | 4 июн 2015 16:40 | 1 |
Problem was solved. Edited by author 04.06.2015 18:02 |
| Why wa 4? | bayram | 1658. Сумма цифр | 4 июн 2015 14:37 | 3 |
Make sure s1 and s2 are within the limits of the problem. ER, thank you! Thanks to author for challenging task. |
| WA4 | HusanKabulov | 1709. Пингвин-Авиа | 4 июн 2015 11:31 | 4 |
WA4 HusanKabulov 5 окт 2009 04:55 Please give me some tests Re: WA4 Oleg Strekalovsky [Retired] 16 окт 2009 21:26 I don't use any graphs algorithms,but only DFS. If you try to solve this problem like me do: 1) break(remove) all cycles 2)Store elements of graph,witch belong to different component's of graph. 3) Connect one of them with others. (one - to every). Not every to every!!! Test 6 1000000 1000000 010000 100000 000100 001000 000001 000010 Edited by author 16.10.2009 21:29 Is this one of the solutions to the above given test? 2000000 00a0a0 000000 a00000 000000 a00000 000000 Re: WA4 amomorning 4 июн 2015 11:31 |
| It is very easy, here is my solution | Dima_Philippov | 1581. Работа в команде | 4 июн 2015 09:13 | 3 |
var a, b : array[1..1000] of integer; n, i, k : integer; begin readln(n); for i := 1 to n do begin read(a[i]); end; i := 2; k := 1; while i <= n + 2 do begin if a[i] = a[i - 1] then begin k := k + 1; i := i + 1; end else begin write(k,' ',a[i - 1],' '); i := i + 1; k := 1; end; end; end. Please explain, why my cod has WT7 and your not) var a:array[1..1000] of integer; i,n,k:integer; Begin readln(n); for i:=1 to n do begin read(a[i]); end; k:=1; i:=2; while i<=n+2 do begin if a[i]=a[i-1] then begin i:=i+1; k:=k+1; end else begin write(k,' ',a[i-1],' '); i:=i+1; k:=1; end; end; End. Edited by author 26.11.2012 23:44 Edited by author 26.11.2012 23:44 #include <bits/stdc++.h> using namespace std; #define maxx 500 #define pb push_back #define pii pair<int,int> queue<int>qu; vector<pii>vpii[maxx]; #define inf 0x7fffffff int X[]={+2,+2,-2,-2,+1,-1,-1,+1}; int Y[]={-1,+1,-1,+1,+2,+2,-2,-2}; int main() { int n,u; cin>>n; vector<int>v; for(int i=0;i<n;i++) { cin>>u; v.pb(u); } int cnt=1,l; for(int i=0;i<v.size();i++) { if(v[i]==v[i+1]) { cnt++; l=v[i+1]; } else{ l=v[i]; cout<<cnt<<" "<<l<<" "; cnt=1; } } return 0; } |
| hint for c++ for those who got wa | TwoEightNine | 1348. Пусти козла в огород 2 | 4 июн 2015 00:19 | 2 |
you need to write answer with two digits after point, so don't use cout! use printf("%.2f\n", ); and don't forget #include <cstdio> i've been finding this mistake for 2 days!! or u can use cout<<setprecision(2)<<fixed<<; |
| WA #3 | Elias | 2034. Корованы | 3 июн 2015 23:30 | 1 |
WA #3 Elias 3 июн 2015 23:30 Does someone have any idea what's test 3? |
| Что тут не правильно? | Mesxi | 1820. Уральские бифштексы | 3 июн 2015 12:00 | 1 |
i understand problem !!! Edited by author 03.06.2015 12:14 |
| в условии ошибка | Иван | 1820. Уральские бифштексы | 3 июн 2015 02:21 | 5 |
если жарить 3 бифштекса на сковороде, где умещается всего 2, то потребуется не 3, а 4 минуты, поскольку последний бифштекс на 2 части не разделить и не положить на сковороду одновременно обоими сторонами хотя нет, в три минуты тоже можно пожарить и разрезать ничего не надо Edited by author 13.05.2014 01:30 Нумеруме бифштексы оригинально 1, 2 ,3. Жарим 1 и 2. Жарим вторую половину 1 и 3. Жарим вторые половины 2 и 3. Вуаля - вы программист! Так вот оказывается как котлеты надо жарить.... |
| Please help me. Why WE? | dood | 1230. Интроспективная программа | 3 июн 2015 00:29 | 1 |
java public class MainClass { public static void main(String[] args) { System.out.println("A=\"'\";B='A=\"\";B=;?$(B,0,4)+A+$(B,4,4)+A+B+A+$(B,8,37)';?$(B,0,4)+A+$(B,4,4)+A+B+A+$(B,8,37)"); } } |
| Help!WA#18 | Amandosov | 1348. Пусти козла в огород 2 | 2 июн 2015 23:31 | 3 |
This is my code #include <iostream> #include <stdio.h> #include <math.h> using namespace std; long n,x[201],y[201]; int main() {double xa,xb,xc,ya,yb,yc,l,a,b,c,x,h; cin>>xa>>ya>>xb>>yb>>xc>>yc>>l; b=sqrt((xc-xa)*(xc-xa)+(yc-ya)*(yc-ya)); a=sqrt((xc-xb)*(xc-xb)+(yc-yb)*(yc-yb)); c=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb)); if(c!=0){ x=(c*c+b*b-a*a)/(2.0*c); h=sqrt(b*b-x*x); if(b!=0&&a!=0){ if((b*b+c*c-a*a)/(2.0*b*c)<=0) h=b; if((a*a+c*c-b*b)/(2.0*a*c)<=0) h=a;}
if(h<=l) h=0; else h=h-l;} else h=a; printf("%0.2f\n",h);
if(a>=b) {if(a<=l) h=0; else h=a-l;} else {if(b<=l) h=0; else h=b-l;} printf("%0.2f\n",h);
return 0; }
Please give me some test Попробуйте 2 2 2 2 3 3 1 Ответ: 0.41 0.41 My program gives the correct output for the test you gave, but still getting wrong answer on test#18. Any suggestions? |
| [removed] | dangminhhieu78 | 1107. Складская задача | 2 июн 2015 21:42 | 1 |
Edited by author 11.06.2015 18:48 Edited by author 11.06.2015 18:48 |
| test data for WA 2 ? | Tom | 1090. Теперь ты в армии | 2 июн 2015 12:10 | 4 |
pls give me some test data, dont know what s wrong with code. greetings. PLEASE NOTE what N and K represent;N represents colums and k represents rows. My code was wrong because of this;Hope you can get help. Thanks!!! I made such mistake :( |
| Why "wrong answer" (1001 - Ruby) | neverhood2015 | 1001. Обратный корень | 2 июн 2015 10:30 | 2 |
My code: a = readlines a = a.join a = a.split(/\s+/) a.reverse! a.map!{|elem|elem.to_i} a.map!{|elem|(elem**0.5).round(4)} puts a I've tried code from FAQ page: tokens = [] while string = gets do string.split().each do |token| tokens << token end end tokens.reverse.each do |token| puts (token.to_i ** 0.5).round(4) end Both variants return right results in my terminal, but in both cases i've got "wrong answer" here. Why? There was a problem with Ruby solutions judging. The solution from FAQ gets AC now. |
| HELP-WA3 | Nik | 1002. Телефонные номера | 2 июн 2015 06:17 | 2 |
I passed all the tests, described above in forum, but Wrong answer3. Give me, please, the test#3? nikolaievgen@gmail.com thanks! Well, it seems that there is more than 100 digits in the number.... |
| My code pass the tests "in console", but it is a wrong answer :(. c++ | Ramshellcinox | 1002. Телефонные номера | 2 июн 2015 02:14 | 1 |
Hi everyone, I was trying to solve this problem, and I use an algorithm that works on "codeblocks", but doesn't work here. I would like that someone help me. This is the code, what is wrong with it? It's Inefficient? Thanks. #include<iostream> #include<vector> #include<string> using namespace std; string convertir(string s){ string conv=""; for(int i=0;i<s.size();i++){ if(s[i]=='i'||s[i]=='j') conv+="1"; else if(s[i]=='a'||s[i]=='b'||s[i]=='c') conv+="2"; else if(s[i]=='d'||s[i]=='e'||s[i]=='f') conv+="3"; else if(s[i]=='g'||s[i]=='h') conv+="4"; else if(s[i]=='k'||s[i]=='l') conv+="5"; else if(s[i]=='m'||s[i]=='n') conv+="6"; else if(s[i]=='p'||s[i]=='r'||s[i]=='s') conv+="7"; else if(s[i]=='t'||s[i]=='u'||s[i]=='v') conv+="8"; else if(s[i]=='w'||s[i]=='x'||s[i]=='y') conv+="9"; else conv+="0"; } return conv; } int main(){ string number,aux; vector<string> dictionary; vector<string> converted; int n; while(cin>>number){ if(number=="-1") break; cin>>n; dictionary.clear(); converted.clear(); for(int i=0;i<n;i++){ cin>>aux; dictionary.push_back(aux); converted.push_back(convertir(aux)); } bool max[100]; for(int i = 1; i<100; i++){ max[i]=false; } max[0]=true; vector<string> sequence(number.size()+1,""); for(int i=1;i<=number.size();i++){ for(int j=0;j<n;j++){ if(converted[j].size()<=i && number.substr(i-converted[j].size(),converted[j].size())==converted[j]){ max[i]=true && max[i-converted[j].size()]; sequence[i]=sequence[i-converted[j].size()]+dictionary[j]+" "; } } } if(max[number.size()]==false) cout<<"No solution."<<endl; else{ aux=sequence[number.size()]; aux.erase(aux.size()-1); cout<<aux<<endl; } } return 0; } |
| I can't understand this problem mean | Nguyen Trung Hieu | 1877. Велосипедные коды | 1 июн 2015 15:40 | 8 |
I can't understand this problem mean, someone can explain it for me? Why first test and second test have this result? Test 1: Den's keys: 0001 0000 1st night 2nd night 3rd night 4th night ... ... ... All nights bike's key 0001 0000 0001 0000 - bad man 0000 0001 0003 0004 - result no no no no no Test 2: Den's keys: 0002 0001 1st night 2nd night 3rd night 4th night ... ... ... All nights bike's key 0002 0001 0002 0001 - bad man 0000 0001 0003 0004 - result no yes no no yes In the first test all nights result is "no". That why in the first test result is no. Very Clear answer ! thank you :) perfect but in line "bad man" , he checks 0002 betwen "0001" and "0003" |