Mission3: obelisk's result

Test case 1

Passed

Run time: 0.09 sec

* Test cases are run from 1 in order. If there is a test case that does not pass, the subsequent test case does not run (knockout system)

points

100 pt Oh, Tatsuya! Let’s give it our best together!!
Language: Ruby
I know, Rena is an eternal idol for me...
Share!
//。♥。・I've written a program in Japanese programming language "Nadeshiko"♥。・٩(๑❛ᴗ❛๑)۶ワァーィ
//How to install( •ॢ◡-ॢ)-♡♡  http://goo.gl/oWWRcM

// \\\\٩( 'ω' )و////Today is also coded to work hard'll !!
// *::;;;;::*゚*::;;;;::*゚*::;;;;::*゚*::;;;;::*゚*::;;;;::*゚*::;;;;::*゚

// ٩(๛ ̆ 3 ̆)۶????Ask~????
「表の横幅、縦幅、選択範囲数は?」と尋ねる
// ☆彡。.:・*゚☆彡。.:・*゚☆彡。.:・*゚☆彡。.:・*゚☆彡。.:・*゚
// ฅ(^ω^ฅ) Saaaaaveニャ~ ᗦ↞◃ ᗦ↞◃ ᗦ↞◃ ᗦ↞◃ᗦ↞◃ ᗦ↞◃ ᗦ↞◃ ᗦ↞◃
一時保存はそれ
一時保存をトークン分割
一時保存はそれ
横幅は一時保存[0]
縦幅は一時保存[1]
選択範囲数は一時保存[2]
// ☆彡。.:・*゚☆彡。.:・*゚☆彡。.:・*゚☆彡。.:・*゚☆彡。.:・*゚
(縦幅)回
// ٩(๛ ̆ 3 ̆)۶????Ask~????
「{回数}行目は?」と尋ねる
縦幅回数は回数-1
一時保存はそれ
一時保存をトークン分割
それを反復
横幅回数は回数-1
配列表\縦幅回数,横幅回数はそれ
// ∞+:;;;;:+∞+:;;;;:+∞+:;;;;:+∞+:;;;;:+∞+:;;;;:+∞+:;;;;:+∞
// ♥コタエワ ( ´◕㉨◕) クマタン♥
答えは0
(選択範囲数)回
// ٩(๛ ̆ 3 ̆)۶????Ask~????
「{回数}つ目の選択範囲は?」と尋ねる
一時保存はそれ
一時保存をトークン分割
一時保存はそれ
// *・゚゚・*:.。..。.:*゚:*:✼✿(ღ✪v✪)。゚:*:✼.。✿.。キラキラ♥
// _:('Θ' 」 ∠):_ タテヨコタテヨコ……プルプルプル
開始横は一時保存[0]
開始縦は一時保存[1]
終了横は一時保存[2]
終了縦は一時保存[3]
縦は終了縦-開始縦+1
横は終了横-開始横+1
// =͟͟͞͞(๑•̀=͟͟͞͞(๑•̀д•́=͟͟͞͞(๑•̀д•́๑)=͟͟͞͞(๑•̀д•́Displays!!
「{縦},{横}」を表示
(縦)回
一時保存縦は回数+開始縦-2
(横)回
一時保存横は回数+開始横-2
答えは答え+配列表\一時保存縦,一時保存横
配列表\一時保存縦,一時保存横は0
// (灬╹ω╹灬)┣¨キ┣¨キ***********
// =͟͟͞͞(๑•̀=͟͟͞͞(๑•̀д•́=͟͟͞͞(๑•̀д•́๑)=͟͟͞͞(๑•̀д•́Displays!!
答えを表示
// *॰ْ✧ً⋆。˚٩(´͈౪`͈٩)yhaaaa⋆。˚*ْ✧ं॰* // *::;;;;::*゚*::;;;;::*゚*::;;;;::*゚*::;;;;::*゚*::;;;;::*゚*::;;;;::*゚

Fix company’s main system!

Just after I arrived at Silicon Valley with Rena, company's main system are down.To make matters worse, architects of this system are no longer with our company!I've got to fix this system and show off my skills to my team.
Problem occured in an application used to compute spreadsheets. Spreadsheets consist of x cells horizontally and y cells vertically with numbers in each cells. You must write a program that export total nunbers in cells selected by user.
A selected range consists of an upper-left cell and lower-right cell, and multiple cells in that rectangular range can be selected. If multiple overlapped rectangular ranges are selected, selected range are grouped together and create a polygon.

Input value of the above data
4 5 3
948 608 920 216
3 413 306 7
312 173 0 1000
365 726 280 358
26 539 197 753
2 1 3 3
3 3 4 4
1 4 4 5

ミッションX

Write a program that output total value in seleced cells.

Input value

Input is applied in the following format:
x y N #Table width x , Table lengthwise width y , Selection range total N
t_1_1 t_2_1 ... t_x_1 #First column of the first row of the table, from x-th column
t_1_2 t_2_2 ... t_x_2 #First column of the second row of the table, from x-th column
...
t_1_y t_2_y ... t_x_y #First column of the y-th row of the table, from which x-th column
x_s_1 y_s_1 x_e_1 y_e_1 #Selection 1 th of the upper-left coordinate x_s, y_e The coordinates of the lower-right x_e, y_e
x_s_2 y_s_2 x_e_2 y_e_2 #Selection 2 th of the upper-left coordinate x_s, y_e The coordinates of the lower-right x_e, y_e
...
x_s_N y_s_N x_e_N y_e_N #Selection N th of the upper-left coordinate x_s, y_e The coordinates of the lower-right x_e, y_e

Constraints

The input values have the following constraints for all test cases.
1 ≦ x, y ≦ 20
1 ≦ N ≦ 10
0 ≦ t_i_j ≦ 1000 (1 ≦ i ≦ x ,1 ≦ j ≦ y)
1 ≦ x_s_k, x_e_k ≦ x (1 ≦ k ≦ N)
1 ≦ y_s_k, y_e_k ≦ y (1 ≦ k ≦ N)

Expected output

Output the total value for the totally of all selected ranges.
Please add a new line at the end, and do not include any unnecessary characters or empty lines.
Example 1(input)
4 5 3
948 608 920 216
3 413 306 7
312 173 0 1000
365 726 280 358
26 539 197 753
2 1 3 3
3 3 4 4
1 4 4 5


Example 1(output)
6664
Example 2(input)
10 5 5
119 677 334 254 884 256 588 445 682 206
691 171 875 407 926 225 313 381 811 637
291 452 658 153 335 657 4 189 408 386
97 750 918 118 334 191 635 341 669 594
51 239 413 394 667 113 558 288 757 788
3 2 6 3
9 4 10 4
10 2 10 5
5 1 6 4
2 2 10 5
Example 2(output)
17895

Your session has expired. Please proceed again from the beginning.

Read from the beginning

Our clients

If you register (login) for paiza, you can download wallpapers!

Then user registration (login) can download 5 kinds of wallpaper in paiza!

Wallpaper 1
Wallpaper 2
Wallpaper 3

無料でプログラミングスキルチェックを試してみる(登録は10秒!)
すぐにプログラミング力をはかるスキルチェック問題にチャレンジできます。(想定解答時間20分)

会員登録(無料)

ページの先頭へ戻る