Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
稀疏矩阵的转置
Time Limit: 6000ms, Special Time Limit:15000ms, Memory Limit:32768KB
Total submit users: 26, Accepted users: 23
Problem 11531 : No special judgement
Problem description
  给定一个稀疏矩阵,求其转置

Input
  输入有若干个案例,每个案例有若干行。每个案例的第1行是3个整数R, C, M,分别表示稀疏矩阵的行数、列数和非零元的个数。其后有M行,每一行是稀疏矩阵的三元组的3个整数:i, j, d。表示该矩阵的第i行、第j列的数是d。三元组按行列顺序给出,首先给出行标号小的,行号一样列标号小的在前。保证所有三元组的i、j各不相同且合法。行、列均从1开始标号。R、C、M全为零表示输入结束。
R、C取值范围在[1, 10000],M不超过10000。d为32位整数。

Output
  每个案例首先输出序号(见样例,Case与冒号无空格,冒号与序号空一格,序号后无空格)。按行列顺序输出转置后的稀疏矩阵的三元组。

Sample Input
3 3 1
1 1 3
Sample Output
Case: 1
1 1 3
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:2063 today,16258790 total, since 2010-05-07