提交时间:2023-10-24 13:52:00
运行 ID: 107506
#include<bits/stdc++.h> using namespace std; int a[30][30]; int main(){ int k; cin>>k; string s; getline(cin,s); for(int i=1;i<=k;i++){ getline(cin,s); int sum=0,sum1=0; for(int j=0;j<=s.size()-1;j++){ if(s[j]!=' '){ if(s[j-1]!=' '&&sum!=0) a[i][sum]=a[i][sum]*10+s[j]-'0'; else{ sum++; a[i][sum]=s[j]-'0'; } } } a[i][0]=sum; for(int j=2;j<=a[i][0];j++){ a[i][j-1]=a[i][j]; } a[i][0]--; cout<<sum<<endl; sum=0; for(int j=1;j<=a[i][0];j++){ cout<<i<<" "<<j<<" "<<a[i][j]<<endl; } } }