Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Страница 2 |
What's wrong? | mb1te | 1506. Столбцы чисел | 9 мар 2018 19:58 | 1 |
WA #2 a = input().split() s = input().split() n, k = int(a[0]), int(a[1]) out = ["" for x in range(n//k+1)] for i in range(k): if i != k - 1: for j in range(n//k+1): if len(s[0]) == 1: out[j] += " " + s[0] s.pop(0) elif len(s[0]) == 2: out[j] += " " + s[0] s.pop(0) else: out[j] += " " + s[0] s.pop(0) else: for j in range(n%k): if len(s[0]) == 1: out[j] += " " + s[0] s.pop(0) elif len(s[0]) == 2: out[j] += " " + s[0] s.pop(0) else: out[j] += " " + s[0] s.pop(0) for i in out: print(i) Edited by author 09.03.2018 19:59 |
Wrong answer test 1 in Java 1.7 please help me | Axmadjon | 1506. Столбцы чисел | 6 май 2014 10:56 | 1 |
import java.util.Scanner; public class _1506 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n, k, j, i; n = s.nextInt(); k = s.nextInt(); k = (n + k - 1) / k; int[] a = new int[n]; for (i = 0; i < n; i++) { a[i] = s.nextInt(); } for (j = 0; j < k; System.out.println(""), j++) for (i = j; i < n; i += k) { System.out.print(" " + a[i]); } } } |
Why WA #10 ? Pascal | Denuha | 1506. Столбцы чисел | 1 мар 2014 16:56 | 1 |
var mas: array [1..100] of integer; mas2: array [1..100, 1..100] of integer; n, k, str, f, i, j, kol: integer; begin readln(n, k); {for i:=1 to n do read mas[i];} {Считаем кол-во строк} if n mod k <> 0 then str := (n div k) + 1 else str := n div k; {Считаем "полную" матрицу} kol := k * str; for i := 1 to n do read(mas[i]); {Заполняем "-1" будущие пустые места} for i := n + 1 to kol do mas[i] := -1; f := 1; for i := 1 to k do for j := 1 to str do begin mas2[j, i] := mas[f]; inc(f); end; for i := 1 to str do begin for j := 1 to k do if mas2[i, j] <> -1 then write(mas2[i, j]:4) else continue; writeln; end; end. |
TEST 2 : | Adhambek | 1506. Столбцы чисел | 8 май 2019 13:23 | 3 |
input : 15 4 1 2 30 994 50 600 700 999 900 990 991 992 993 40 800 output : 1 50 900 993 2 600 990 40 30 700 991 800 994 999 992 input:: 9 2 1 2 3 4 5 6 7 8 9 output:: 1 6 2 7 3 8 4 9 5 9 4 100 10 1 0 999 2 999 999 1 out: 100 0 999 10 999 999 1 2 1 Edited by author 08.05.2019 13:24 Edited by author 08.05.2019 13:24 |
Pretty shit task | Andrew Sboev | 1506. Столбцы чисел | 9 фев 2013 11:45 | 3 |
Some tests 7 2 1 2 3 4 5 6 7 Answer 1 5 2 6 3 7 4 7 6 1 2 3 4 5 6 7 Answer 1 3 4 5 6 7 2 This answer can't be right. Only the last column may be smaller. Here 5 columns are smaller. OK, second test is not correct, I think now. |
My AC solution | Homka | 1506. Столбцы чисел | 4 дек 2012 17:50 | 2 |
C++, 0.015 sec, 196 Kb #include <iostream> using namespace std; int main() { int n,k; cin>>n>>k; int m=n/k + ((n%k==0) ? 0:1); int * A=new int [m*k]; for (int i=0;i<n;i++) { cin>>A[i]; } for (int i=n;i<m*k;i++) A[i]=-1; for (int i=0;i<m;i++) { for (int j=0;j<k;j++) { int h=j*m+i; if (A[h]<0) cout<<" "; if (A[h]>-1 && A[h]<10) cout<<" "<<A[h]; if (A[h]>9 && A[h]<100) cout<<" "<<A[h]; if (A[h]>99 && A[h]<1000) cout<<" "<<A[h]; } cout<<endl; } return 0; } Waiting of comments C, 0.015 sec, 112 kb main() { short n,k,a[101],i,j; scanf("%d %d",&n,&k); k=(n+k-1)/k; for(i=0;i<n;i++)scanf("%i",&a[i]); for(j=0;j<k;puts(""),j++) for(i=j;i<n;i+=k) printf("%4d",a[i]); } |
1334 | davlatov jaloliddin | 1506. Столбцы чисел | 9 дек 2011 19:53 | 1 |
1334 davlatov jaloliddin 9 дек 2011 19:53 |
If you have wa 10 try this test | Hrayr[Goris N4 High School] | 1506. Столбцы чисел | 4 дек 2012 17:41 | 2 |
100 1 1 2 3 4 .. 99 100 ans: 1 2 3 4 .. 99 100 Edited by author 09.07.2011 17:54 My AC code : ans: 1 2 3 4 . . . 99 100 |
WA 10 | Ilia | 1506. Столбцы чисел | 4 дек 2012 17:49 | 2 |
WA 10 Ilia 26 апр 2011 20:29 What's incorrect????? int main() { int n, k; scanf("%d %d", &n, &k); vector<int> mas(100);
mas.assign(100, -1); for (int i=0; i<n; i++) scanf("%d", &mas[i]); int s=n/k; if(n%k!=0) s++; for (int i=0; i<s; i++) { for(int j=0; j<k; j++) if (mas[s*j+i]!=-1) printf("%4d", mas[s*j+i]); printf("\n"); } return 0; } Edited by author 26.04.2011 20:30 vector<int>mas; mas.assign(111,-1); |
what is wrong with my code | esger | 1506. Столбцы чисел | 27 окт 2010 16:34 | 3 |
I get WA#1 here is my code #include <cstdlib> #include <iostream> using namespace std; int i, j, n, k, say, a[101]; int main(int argc, char *argv[]) { cin >> n >> k;
for( i = 0; i < n ; i++ ) cin >> a[ i ]; if( n%k != 0) say = n/k + 1; else say = n/k;
for( j = 0; j < say; j++ ){ cout << a[ j ]; i = j + say; while( i < n){
cout <<" "<< a[ i ]; i += say; } if( j < say-1 ) cout << endl; }
return 0; } Output: The width of each column must be 4 symbols; the numbers must be aligned to the right edge and padded with spaces to the required width hi.you have 3 error's 1.you get 1 test case,but question has t test case. you can add while(cin>>n>>k){...} to het t,test case,t>0; 2.you end of ant test case add cout<<endl; 3.to any answer printf(" %3d",a[i]); good luck. |
What is the answer for the following test, please help | ahmedov(NUUz_2) | 1506. Столбцы чисел | 6 ноя 2009 23:14 | 1 |
|
Please, help.Where is my mistake? | ahmedov(NUUz_2) | 1506. Столбцы чисел | 6 ноя 2009 19:09 | 1 |
#include <stdio.h> int x[101]; void main() { int n=0,m=0,i=0,j=0,k=0; scanf("%d", &n); scanf("%d", &m); i=0; for (i=0;i<n;i++) scanf("%d", &x[i]); i=0; m=2; while ((i<n)&&(k<n)) { j=i; while (j<n) { printf("%4.d",x[j]); j=j+m; k++; } printf("\n"); i++; }
} |
MISTAKE | Ilya (Vologda SPU) | 1506. Столбцы чисел | 21 окт 2009 01:52 | 3 |
MISTAKE Ilya (Vologda SPU) 20 окт 2009 01:41 4 3 1 2 30 40 For this input there is no solution!! No way exists for 4 numbers to be placed into 3 columns, when 2 columns has equal length and 3rd has littler length! (but this input doesn't permitted by the statement of the task o_O) И что с этим делать? Я опять запутался >_< Edited by author 20.10.2009 21:41 Re: MISTAKE Alex Tolstov (Vologda STU) 21 окт 2009 01:52 Read the statement more carefully. It is guaranteed that solution is always exist. |
Mistake in statement | Fyodor Menshikov | 1506. Столбцы чисел | 24 авг 2009 19:51 | 2 |
|
Страница 1 |
help!!!!! | zsyzhbc_china | 1506. Столбцы чисел | 22 май 2009 11:48 | 1 |
program t1506; var n,m,a,b,c,i,j,l:integer; k,o:real;s:string; h:array [1..100] of integer; q:array [1..10,1..10] of integer; p:array [1..10,1..10] of integer; begin readln(n,k); for i:=1 to n do read(h[i]); m:=trunc(sqrt(n)); if frac(sqrt(n))<>0 then inc(m); for i:=1 to m do for j:=1 to m do begin inc(b); p[i,j]:=h[b]; str(h[b],s); q[i,j]:=length(s); if q[i,j]>a then a:=q[i,j]; end; for i:=1 to m do for j:=1 to m do begin write(' '); for b:=1 to (a-q[j,i]) do write(' '); if j<>m then begin write(p[j,i]); inc(l); end else begin writeln(p[j,i]); inc(l); end; if l=n then halt; end; end. Edited by author 03.03.2010 10:22 |
Please answer my test! | BlackShark | 1506. Столбцы чисел | 11 мар 2009 15:54 | 3 |
which answer? n=11,k=5, '1 2 3 4 5 6 7 8 9 10 11'; 1 4 7 10 ? 2 5 8 11 ? 3 6 9 ? ? or 1 4 6 8 10 2 5 7 9 11 3 ? ? ? I think this is incorrect test. There is no solution. My AC program show : 1 3 5 7 9 11 2 4 6 8 10 Edited by author 11.03.2009 15:54 |
WA#1 | Samvel | 1506. Столбцы чисел | 3 июн 2008 20:36 | 1 |
WA#1 Samvel 3 июн 2008 20:36 My answer is right on computer's test, but I don't understand, why I've got WA#1. Please, help me. Here my code # include<iostream.h> int main() { int n, k, a[101], i, j=0, h=0, p, b[101][101]; cin>>n>>k; if (n%k==0) p=n/k; else p=n/k+1; for (i=0; i<n; i++) { cin>>a[i]; if (j==p) { j=0; b[j++][++h]=a[i]; } else b[j++][h]=a[i]; } for (i=0; i<p; i++) { for (j=0; j<k && b[i][j]>=0 && b[i][j]<1000;j++) { if (b[i][j]>=0 && b[i][j]<=9) cout<<" "<<b[i][j]; else if (b[i][j]>=10 && b[i][j]<=99) cout<<" "<<b[i][j]; else cout<<" "<<b[i][j]; } if (i<p-1) cout<<endl; } return 0; } Edited by author 03.06.2008 20:40 |
Strange test | Tural Neymanov | 1506. Столбцы чисел | 11 мар 2009 15:55 | 3 |
Is this Test correct? 4 3 1 2 3 4 >> 1 3 2 4 my AC prog. gives me that answer because 1 2 3 ___4 isn't correct 100%. {same test 16 5} Edited by author 09.04.2008 23:39 There are some numbers n and k, that there is not any correct solution. Probably your case is one of them. P.S. See my post. Re: Strange test Phan Hoài Nam - Đại học Ngoại ngữ Tin Học TP.HCM 11 мар 2009 15:55 My AC program show : 1 3 4 2 |
Can you help me? | Li Wang Ji | 1506. Столбцы чисел | 11 апр 2008 02:34 | 3 |
Although my program passes all tests indicated in webboard, I have WA#3... My algo is quite simple. I increase the number of rows from one until it fits in K columns... Where is my fault? Thx in advance I think I know your algo. if you did the inequality in your program like "l<n" do it "l<=n". I think it should pass. For WA11 Tural Neymanov 11 апр 2008 02:34 do array of integer; (not shortint, smallint, byte) |
WA #8 | Ferman | 1506. Столбцы чисел | 30 ноя 2008 14:51 | 2 |
WA #8 Ferman 9 апр 2008 14:04 what is the test? Say please I check all tests but all is correct what is worng? if you make your massiv global you have to write one more if for "0" |