1974: ArrayList Insertion
内存限制:128 MB
时间限制:1.000 S
评测方式:文本比较
命题人:
提交:33
解决:3
题目描述
define a student class including name,number,sex.
define an arrayList to store students,and insert a student into the list.
输入
there are many cases,for each case,input n to denote the number of students,and then input n students;
input an correct index and a student who is to be inserted,if the index is incorrect:
1)if the index is negative, insert into the head(index 0) of the arrayList.
2)if the index is beyond the size of the arrayList,insert into the rear of the arrayList
finally,display the arrayList输出
display the final arrayList
样例输入 复制
2
zhangsan 20120866601 m
lishi 20120866603 f
2 wangwu 20120866604 m
2
zhangsan 20120866601 m
lishi 20120866603 f
3 wangwu 20120866604 m
2
zhangsan 20120866601 m
lishi 20120866603 f
-3 wangwu 20120866604 m
样例输出 复制
Case 1:
zhangsan 20120866601 m
lishi 20120866603 f
wangwu 20120866604 m
Case 2:
zhangsan 20120866601 m
lishi 20120866603 f
wangwu 20120866604 m
Case 3:
wangwu 20120866604 m
zhangsan 20120866601 m
lishi 20120866603 f