15 条题解

  • 4
    @ 2023-9-30 21:11:27

    代码如下:

    #include <iostream>
    using namespace std;
    int main()//头文件
    {
        int x;//定义变量
        cin >> x;//输入
        for (int i=1;;i++)//没有条件
        {
            x+=2;//加2
            if (x%3==0)//如果加完后的结果是3的倍数
            {
                x+=3;//额外加3
            }
            if (x>100)//如果x大于100
            {
                break;//停止这个循环,此时x第一次大于100
            }
        }
        cout << x;//输出
        return 0;//好习惯!
    }
    
    • 4
      @ 2022-5-3 11:38:53

      用while循环即可

      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	int x;
      	cin >> x;
      	while(x<=100){
      		x+=2;
      		if(x%3==0){//特判
      			x+=3;
      		}
      	}
      	cout << x;
      	return 0;
      }
      
      • 3
        @ 2024-1-30 16:50:31

        某有说的

        #include <bits/stdc++.h>
        using namespace std;
        int x;
        int main(){
            cin>>x;
            while (x<=100){
                x+=2;
                if (x%3==0)x+=3;
            }
            cout<<x;
            return 0;
        }
        
        • 3
          @ 2023-12-8 21:24:57
          #include<bits/stdc++.h>
          using namespace std;
          int main(){
          	int x;
          	cin >> x;
              if(x==1)
              {
                  cout<<105;
              }
              else if(x==4)
              {
                  cout<<101;
              }
              else
              {
              cout<<102;
              }
          	return 0;
          }
          
          • 3
            @ 2023-1-13 14:44:27

            有手就行

            #include <bits/stdc++.h>//万能头文件
            using namespace std;//调用命名空间std
            int main()//主函数
            {   //只是一个左大括号
                int x;//设置一个变量
                cin>>x;//输入
                while(x<=100){//直到x大于100
                    x+=2;//x加2
                    if(x%3==0)//如果加完是3的倍数
                        x+=3;//额外再加3
                }cout<<x;//别忘了输出x
                return 0;//结束
            }//只是一个右大括号
            
            
            
            </span>
            • 3
              @ 2022-5-5 18:42:55
              #include <bits/stdc++.h>
              using namespace std;
              int main()
              {
                  //思路:用猫子帮你做模拟
                  int n;
                  cin >> n;
                  while(n <= 100)
                  {
                      n += 2;//模拟
                      if(n % 3 == 0) n += 3;//特胖(判)
                  }
                  cout << n;
                  return 0;
              }
              
              • @ 2022-5-6 22:35:01

                我会使用python脚本调取网页日志比对每个人提交的代码,有抄袭会取消成绩~

            • 2
              @ 2023-7-31 19:20:46
              #include <bits/stdc++.h>
              using namespace std;
              int main(){
                  int n;
                  cin >> n;
                  while (n <= 100){
                      n += 2;
                      if (n % 3 == 0) n += 3;
                  }
                  cout << n;
              }
              
              • 2
                @ 2022-8-23 10:51:36
                while (x<=100)//模拟直到x不小于等于100
                {
                    x+=2;
                    if (x%3==0)
                    {
                        x+=3;
                    }
                }
                
                • 2
                  @ 2022-7-18 21:37:50
                  #include <bits/stdc++.h>
                  using namespace std;
                  int main() {
                  int x;//定义x
                  cin >> x;//输入x
                  while(x <= 100) {//因为不知道要多少次,使用while
                  x += 2;//执行x加2的操作
                  if (x % 3 == 0) {//判定x是不是3的倍数
                  x += 3;//如果是,就额外加3
                  }
                  }
                  cout << x << endl;//输出x
                  return 0;
                  }
                  
                  • 2
                    @ 2022-7-2 16:24:58

                    QWQ 我不知道,我哪只眼睛把这题看成高精了

                    “简短”的 AC 代码( 3ms ):

                    #include <iostream>
                    using namespace std;
                    
                    struct QWQ{ //定义结构体 QWQ
                    	int s[5005]; //s[0] = len
                    	//字符串存数
                    
                        //结构体里可以放函数
                    	void read(){ //读入高精数函数
                    		string in;
                    		cin >> in;
                    		s[0] = in.size();
                    		for(int i = 1;i <= s[0];i++)
                    			s[i] = in[s[0] - i] - '0'; //把char 转换为 int 比如说 '5' - '0' = 5
                    	}
                    	
                    	void print(string end = ""){ //输出高精数
                    		for(int i = s[0];i >= 1;i--) //一位一位输出即可
                    			cout << s[i];
                    		cout << end;
                    	}
                        
                    	bool operator <= (long long b){ //重载比较运算符 <=
                    		QWQ t;
                    		t = b;
                    		if(s[0] == t.s[0]){
                    			for(int i = s[0];i >= 1;i--)
                    				if(s[i] != t.s[i])
                    					return (s[i] < t.s[i]);
                    		}
                    		else
                    			return (s[0] < t.s[0]);
                    		return true;
                    	}
                    	
                    	bool operator == (QWQ b){ //重载比较运算符 ==
                    		//一位一位比较即可,s[1] 是最高位,s[s[0]] 是最低位
                    		if(s[0] != b.s[0])
                    			return false;
                    		for(int i = 1;i <= b.s[0];i++)
                    			if(s[i] != b.s[i])
                    				return false;
                    		return true;
                    	}
                    			
                    	QWQ operator = (QWQ b){ //重载赋值 = ,但似乎不需要 
                    		for(int i = 0;i <= b.s[0];i++) 
                    			s[i] = b.s[i];
                    		return *this;
                    	}
                    		
                    	QWQ operator = (long long b){ //重载赋值 =
                    		if(b == 0){ //0需要特判
                    			s[0] = 1;
                    			s[1] = 0;
                    			return *this;
                    		}
                    		long long awa = b , len = 0;
                    		while(awa){
                    			s[++len] = awa % 10;
                    			awa /= 10;
                    		}
                    		s[0] = len;
                    		return *this;
                    	}
                    	
                    	void operator += (long long b){ //重载 +=
                    		//把 b 加到高精数的最高位(s[1]),然后进位
                    		s[0]++; //这个地方只适用与 b 较小的情况下
                    		s[1] += b;
                    		int x = 0;
                    		for(int i = 1;i <= s[0];i++){
                    			s[i] += x;
                    			x = s[i] / 10;
                    			s[i] %= 10;
                    		}
                    		while(s[s[0]] == 0 && s[0] > 1)
                    			s[0]--;
                    	}
                    	
                    	QWQ operator % (long long b){ //重载 %
                            //大数取余 15 % 2 = (10 % 2 + 5 % 2) % 2
                    		long long rrr = 0;
                    		for(int i = 1;i <= s[0];i++)
                    			rrr = (rrr * 10 + s[i] - '0') % b;
                    		QWQ r;
                    		r = rrr;
                    		return r;
                    	}
                        //重载完后就可以像int 一样进行模拟了
                    };
                    
                    int main(void){
                        cin.tie(0); //输入优化
                        cout.tie(0);
                    	QWQ x , qwq; //声明高精数
                    	qwq = 0;
                    	x.read(); //读入
                    	while(x <= 100){ //按照题目意思开始模拟
                    		x += 2;
                    		if(x % 3 == qwq)
                    			x += 3;
                    	}
                    	x.print("\n"); //输出
                    }
                    
                    • 1
                      @ 2024-3-13 19:34:39

                      哈哈哈L8的题太简单了

                      #include <iostream>
                      using namespace std;
                      int main()
                      {
                          int x;
                          cin >> x;
                          while(x<=100)
                          {
                              x+=2;
                              if (x%3 == 0)
                              {
                                  x+=3;
                              }
                          }
                          cout << x;
                          return 0;
                      }
                      

                      已AC

                      • 1
                        @ 2023-8-15 10:19:44
                        #include <bits/stdc++.h>
                        using namespace std;
                        int main()
                        {
                            int n;
                            cin >> n;
                            while (n <= 100)
                            {
                                n += 2;
                                if (n % 3 == 0) n += 3;
                            }
                            cout << n;
                        }
                        
                        • 1
                          @ 2023-6-23 17:53:28

                          这道题太简单,虽然是四星题单,虽然标签是模拟,但……难度是一星的啊!!!(可还是有人不会做) AC代码走起!!!

                          #include <bits/stdc++.h>
                          using namespace std;
                          int x;
                          int main()
                          {
                              cin >> x;
                              while (x <= 100)
                              {
                                  x += 2;
                                  if (x % 3 == 0)
                                  {
                                      x += 3;
                                  }
                              }
                              cout << x << endl;
                              return 0;
                          }
                          

                          请注意必须抄袭题解,写题解需要只放代码,不能加上你的思路或代码注释。抄袭题解一经发现直接成绩满分!!!

                          • 1
                            @ 2022-9-7 20:27:50
                            #include <bits/stdc++.h>
                            using namespace std;
                            int main()
                            {
                                int x;
                                cin >> x;
                                while(x<=100)
                                {
                                    x+=2;
                                    if(x%3==0)x+=3;
                                }
                                cout<<x;
                            }
                            //真的超简单啊没什么好说的,自信不验一遍过
                            
                            </span>
                            • -6
                              @ 2022-4-24 16:13:32

                              鼓励大家写题解,但注意题解格式。

                              给代码两端加上这个会舒服一些

                              ```cpp

                              你的代码

                              ```

                              </span>

                              这个点在键盘的左上角tab上面那个键,注意切换输入法

                              #include<iostream>
                              using namespace std;
                              int main()
                              {
                                  int n;
                                  cin>>n;//这是一个注释
                                  return 0;
                              } 
                              

                              请注意严禁抄袭题解,写题解不要只放代码,需加上你的思路或代码注释。

                              抄袭题解一经发现直接取消成绩。

                              • 1

                              信息

                              ID
                              1336
                              时间
                              1000ms
                              内存
                              256MiB
                              难度
                              1
                              标签
                              递交数
                              394
                              已通过
                              260
                              上传者