返回列表 發帖

抓取空白分隔的數字(已知數目)

本帖最後由 tonyh 於 2022-12-8 20:40 編輯

範例輸入:
12
5 0 4 0 2 6 0 8 14 0 7 1

範例輸出:
5 0 4 0 2 6 0 8 14 0 7 1
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n, data[100001];
  4. int main()
  5. {
  6.     cin.tie(0);
  7.     cin.sync_with_stdio(0);

  8.     cin>>n;

  9.     for(int i=0; i<n; i++)
  10.         cin>>data[i];

  11.     for(int i=0; i<n; i++)
  12.         cout<<data[i]<<" ";
  13.     cout<<endl;

  14.     return 0;
  15. }

  16. /*
  17. 12
  18. 5 0 4 0 2 6 0 8 14 0 7 1
  19. */
複製代碼

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. //#define int ll
  5. #define FOR(i,a,b) for(int i=a;i<b;i++)
  6. #define REP(i,n) FOR(i,0,n)
  7. #define REP1(i,n) FOR(i,1,(n)+1)
  8. #define RREP(i,n) for(int i=(n)-1;i>=0;i--)
  9. #define f first
  10. #define s second
  11. #define pb push_back
  12. #define ALL(x) x.begin(),x.end()
  13. #define SZ(x) (int)(x.size())
  14. #define SQ(x) (x)*(x)
  15. #define pii pair<int,int>
  16. #define Graph vector<vector<int>>
  17. #define IOS() cin.sync_with_stdio(0),cin.tie(0),cout.tie(0)
  18. const ll inf=(1ll<<63)-1;
  19. const int maxn=1e4+5;
  20. const ll mod=1e9+7;
  21. int n,x;
  22. signed main()
  23. {
  24.     IOS();
  25.     cin>>n;
  26.     REP(i,n) {
  27.         cin>>x;
  28.         cout<<x<<" ";
  29.     }
  30.     return 0;
  31. }
複製代碼
Allen

TOP

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n, data[100001];
  4. int main()
  5. {
  6.     cin.tie(0);
  7.     cin.sync_with_stdio(0);
  8.     cin>>n;
  9.     for(int i=0; i<n; i++)
  10.         cin>>data[i];
  11.     for(int i=0; i<n; i++)
  12.         cout<<data[i]<<" ";
  13.     cout<<endl;
  14.     return 0;
  15. }
複製代碼
Ivy

TOP

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int n, data[100001];
  4. int main()
  5. {
  6.     cin.tie(0);
  7.     cin.sync_with_stdio(0);
  8.     cin>>n;
  9.     for(int i=0; i<n; i++)
  10.         cin>>data[i];
  11.     for(int i=0; i<n; i++)
  12.         cout<<data[i]<<" ";
  13.     cout<<endl;
  14.     return 0;
  15. }
複製代碼

TOP

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. stringstream ss;
  4. int n,data[100001];
  5. int main()
  6. {
  7.     cin.sync_with_stdio(0);
  8.     cin.tie();
  9.     cin>>n;
  10.     for(int i=0;i<n;i++){
  11.         cin>>data[i];
  12.     }for(int i=0;i<n;i++){
  13.         cout<<data[i]<<" ";
  14.     }
  15.     return 0;
  16. }
複製代碼
hahahahahahahaha

TOP

返回列表