473,587 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

something wrong to uri 1478 solution

1 New Member
I am new at python...I write this code. This is a uri problem and problem no 1478.Here the uri problem link:https://www.urionlinejudge.com.br/ju...lems/view/1478
My code:
Expand|Select|Wrap|Line Numbers
  1. while(1):
  2.     N=int(input())
  3.     if(N==0):
  4.         break
  5.  
  6.     mainlist=[]
  7.     for i in range(0,N):
  8.         sublist=[]
  9.         for j in range(0,N):
  10.             sublist.append(9)
  11.         mainlist.append(sublist)
  12.  
  13.     print(mainlist)
  14.  
  15.     a=0
  16.     b=N
  17.     c=0
  18.     d=N-1
  19.     k=1
  20.     for j in range(0,N):
  21.         for i in range(a,b):
  22.             mainlist[c][i]=i+k
  23.             mainlist[i][c]=i+k
  24.             mainlist[d][N-1-i]=i+k
  25.             mainlist[N-1-i][d]=i+k
  26.  
  27.         a+=1
  28.         b-=1
  29.         c+=1
  30.         d-=1
  31.         k-=1
  32.  
  33.     for i in range(0,N):
  34.         for j in range(0,N-1):
  35.             print(" ",mainlist[i][j],end=" ")
  36.         print(" ",mainlist[i][N-1])
  37.     print("")
but when i submit this on uri...showing something error.and couldnt found this.Please anyone help me to fine the error of my code.
Jul 9 '18 #1
1 1723
Rabbit
12,516 Recognized Expert Moderator MVP
Please use code tags when posting code or formatted data.

Did you try running your code to see if the output matches? Because it doesn't. Your code prints out extra stuff that it's not looking for. Specifically arrays filled with a bunch of 9s.
Jul 9 '18 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2332
by: uberderf | last post by:
I have the following web page setup: http://angels.uberderf.com/glossary.html I have a 2 column table layout which is a glossary of terms and their meanings. When you view this page in firefox the first row displays with a lot of space below the two cells. The rest of the table looks as it was intended to look. This same page viewed in Mozilla looks correct or how it was intended to look. Even IE displays the page as intended.
3
1365
by: Charles May | last post by:
I have a listview which checkboxes containing items to invoice. The Create Invoice button (button1) is disabled unless there are items checked. However, I had to use an if..then..else statement to make it work. My question is, why can I not get it to work using an IIF statement? In the mouseup event of the listview I tried the following methods to achieve the result. This doesn't work
4
2221
by: Robert | last post by:
something wrong in wx I wrote program training na Artificial Neural Network. It work well in console mode, but when I try to add GUI there is an error: FANN Error 10: Error reading info from train data file "zapis.txt", line: 2 There is a code: ##### this work ############ #!/usr/bin/python import fann
3
2778
by: Cor | last post by:
Hi all, I think I do something wrong, but I don't see what. I have made a sample. The sample needs only a form with a combobox and this code. (I can tell you that it took a long time to see this, but it still can be that I do something stupid). When I fill a combobox (1) direct, I get after SelectionChangeCommitted the previous selected item.
1
1421
by: Holly | last post by:
One of my clients called me this morning, having trouble with their blog loading. The blog does actually load, but only after such an unusually long wait it would have surely driven everyone else away first. If you go to www.spusa.org and click on the link "blog" you'll see what I mean. Then when the page *does* load, there's something wrong with the background where the white part fades away and the rest of the text displays on the...
9
1726
by: Randy | last post by:
Hi all, I've been working on a simple two column layout for a site, but according to browsershots.org, my desing is not showing up correctly in Win/IE 5.01, 5.5 & 6 ! Please see details here: http://browsershots.org/screenshots/8403b5f07d234613073ae00a03fcbbf9/ Please note that only IE7 got the design right.
1
2219
by: alvarojaviervera | last post by:
Allways I think Firefox was strong, enough ... and so far THE BEST Web- browser (That what I Think) but, now Im fighting with it, may be Im doing something wrong (of course that is what happend to me) .... <script LANGUAGE="JavaScript"> <!-- var msg1=""; var msg2=""; function Mostrar(valor)
13
1558
compman9902
by: compman9902 | last post by:
Hello, and thank you for hwlping me with this run-in with trouble. I am making a script for pig latin transulation, and there is something wrong with the "if" statement in line 51. Here is the code so far: #include <iostream> #include <stdlib.h> #include <string.h> using namespace std; string platin(string original); int main() { string bub;
10
2483
by: Guillermo_Lopez | last post by:
Hello All, I am using VBA in access to perform some calculations. There is a particular sumation that is wrong (barely). this code is withing a loop. TDist = TDist + TempDist Both TDist and TempDist are declared as doubles:
0
1109
by: Pat | last post by:
Hi Guys, Please help me. I am having a strange issue. Not sure if I am doing something wrong or this is a bug. This is a sample code. This contains 2 text boxes(txtName, txtPhone) and 2 buttons (btnAdd, btnSave) Table(dtCustomers) contains three rows, with customer name "a", "b" and "c". Now I press "btnAdd" button to add a new row. Then I type "d" as name and "123" ad phone number.
0
8219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.