2 solutions

  • 4
    @ 2023-10-25 17:01:42
    #include <bits/stdc++.h>
    using namespace std;
    
    void Memcpy(char * src, char * dest, int n) {
    	for (int i = 0;i < n;i++){
    		dest[i] = src[i];
    	}// 在此处补充你的代码,可以多行
    }
    
    int Strlen(char * s) {
        int i;
        for( i = 0; s[i]; ++i);
        return i;
    }
    
    int main() {
        int a;
        char s1[30];
        char s2[30];
        int t;
        cin >> t;
        for(int i = 0; i < t; ++i) {
            cin >> a;
            int b = 99999999;
            Memcpy((char*)&a, (char *) &b, sizeof(int));
            cout << b << endl;
        }
        for(int i = 0; i < t; ++i) {
            cin >> s1;
            Memcpy(s1, s2, Strlen(s1) + 1);
            cout << s2 << endl;
        }
        return 0;
    }
    
    • -2
      @ 2024-9-22 19:59:35
      #include<iostream>
      #include<queue>
      #include<stack>
      #include<cmath>
      #include<algorithm>
      #include<cstring>
      using namespace std;
      int main()
      {
      	string b,*c;//直接把其所有当字符串定义
      	int a,i=0;
      	cin>>a;
      	while(i<=a+a)
      	{
      		i++;
      		cin>>b;
      		c=&b;//给指针赋值
      		cout<<*c<<endl;//输出
      	}
      	return 0;
      }  
      
      

      不要抄哦(‾◡◝)

      • 1

      Information

      ID
      922
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      3
      Tags
      # Submissions
      68
      Accepted
      35
      Uploaded By