316 条题解

  • 0
    @ 2026-3-12 17:02:55
    using namespace std;
    // 判断 a 是否赢 b
    bool win(int a, int b) 
    {
        if( (a == 0 && b == 2) || (a == 2 && b == 5) || (a == 5 && b == 0))
    		return true;
    	else
    		return false;
    }
    int mo(int a, int b,int c)
    {
    	if(a%b!=0)
    		return a%b;
    	else
    		return c;
    }
    int main() 
    {
        int N, NA, NB; 
    	int A[200], B[200]; 
    	int winA = 0, winB = 0;  
        cin >> N >> NA >> NB; 
        for (int i = 1; i <= NA; i++) 
    		cin >> A[i];
        for (int i = 1; i <= NB; i++) 
    		cin >> B[i];       
        for (int i = 1; i <= N; i++)  
    	{		
    		int a_move = A[mo(i,NA,NA)]; 		
    		int b_move = B[mo(i,NB,NB)];	
            if (win(a_move, b_move))  
    		{
            	winA++;
            } 
    		else if (win(b_move, a_move))
    		{
            	winB++;
            }
        }
        if (winA > winB) 
    	{
            cout << "A" <<winA-winB<< endl;
        } 
    	else if (winB > winA) 
    	{
            cout << "B" << winB-winA<<endl;
        } 
    	else 
    	{
            cout << "draw" << endl;
        }
        
        return 0;
    }
    
    • 0
      @ 2026-3-12 17:02:34

      #include <bits/stdc++.h> using namespace std; // 判断 a 是否赢 b bool win(int a, int b) { if( (a == 0 && b == 2) || (a == 2 && b == 5) || (a == 5 && b == 0)) return true; else return false; } int mo(int a, int b,int c) { if(a%b!=0) return a%b; else return c; } int main() { int N, NA, NB; int A[200], B[200]; int winA = 0, winB = 0; cin >> N >> NA >> NB; for (int i = 1; i <= NA; i++) cin >> A[i]; for (int i = 1; i <= NB; i++) cin >> B[i]; for (int i = 1; i <= N; i++) { int a_move = A[mo(i,NA,NA)]; int b_move = B[mo(i,NB,NB)]; if (win(a_move, b_move)) { winA++; } else if (win(b_move, a_move)) { winB++; } } if (winA > winB) { cout << "A" <<winA-winB<< endl; } else if (winB > winA) { cout << "B" << winB-winA<<endl; } else { cout << "draw" << endl; }

      return 0;
      

      }

      • 0
        @ 2026-2-27 12:21:34

        洛谷娘

        • 0
          @ 2026-2-13 15:25:27
          using  namespace std;
          long long sum,a[1001000],k,n,m;
          int main()
          {
          cin>>n>>m;
          k=sqrt(m);
          for(int i=2;i<=k;i++)
          if(a[i]==0)
          for(int j=i*i;j<=m;j+=i*i)
          a[j]=1;
          for(int i=n;i<=m;i++)
          if(a[i]==0) sum++;
          cout<<sum;
          return 0;
          }
          
          • 0
            @ 2026-2-12 12:06:56
            #include<bits/stdc++.h>
            using namespace std;
            int n,l,r;
            int main(){
                cin>>n>>l>>r;
                if(r/n==l/n)
                    cout<<r%n<<endl;
                else
                    cout<<n-1<<endl;
                return 0;
            }
            
            • 0
              @ 2026-2-11 10:25:58

              • 0
                @ 2026-2-9 10:15:26
                #include <bits/stdc++.h>
                using namespace std;
                long long n,m,a[50010],b[50010],ans,x,y;
                int main(){
                	cin>>n>>m;
                	for(int i=1;i<=n;i++) cin>>a[i];
                	for(int i=1;i<=m;i++) cin>>b[i];
                	sort(a+1,a+n+1);
                	sort(b+1,b+m+1);
                	x=1;y=1;
                	while(1) {
                		if(a[x]<=b[y]) {
                			ans+=b[y];
                			x++;
                		}
                		y++;
                		if(x>n) {
                		   cout<<ans;
                		   return 0;	
                		}
                		if(y>m) {
                			cout<<-1;
                			return 0;
                		}
                	}
                }
                
                • 0
                  @ 2026-1-17 16:20:35

                  666下面一片红的玩意是啥?????????

                  • 0
                    @ 2026-1-17 14:43:57

                    真的 #include<bits/stdc++.h> using namespace std; int n,m,k,b[110][110],ans; char x; int main() { cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { cin>>x; b[i][j]=b[i-1][j]+b[i][j-1]-b[i-1][j-1]; if(x=='1') b[i][j]++; } for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { for(int x=i;x<=n;x++) for(int y=j;y<=m;y++) { if(b[x][y]-b[i-1][y]-b[x][j-1]+b[i-1][j-1]==(x-i+1)(y-j+1)) ans=max(ans,(x-i+1)(y-j+1)); } } cout<<ans; }

                    • 0
                      @ 2026-1-17 14:40:30

                      就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是就是

                      • 0
                        @ 2026-1-17 14:40:25

                        你本来就没有

                        • 0
                          @ 2026-1-17 14:38:59

                          杨骐骏你的小jj没了

                          • 0
                            @ 2026-1-17 14:37:52

                            啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里 啦啦啦啦啦啦啦啦库里库里库库里

                            • 0
                              @ 2026-1-17 14:37:42

                              我刚刚没复制

                              • 0
                                @ 2026-1-17 14:37:10

                                反正是真的,爱要不要!

                                • 0
                                  @ 2026-1-17 14:36:03

                                  啦啦啦啦啦啦啦啦库里库里库库里

                                  • 0
                                    @ 2026-1-17 14:35:08

                                    我就不信啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦

                                    • 0
                                      @ 2026-1-17 14:34:56

                                      对的

                                      • 0
                                        @ 2026-1-17 14:32:25

                                        错的 叫个蛋

                                        • 0
                                          @ 2026-1-17 14:31:31

                                          爱要不要!

                                          信息

                                          ID
                                          104
                                          时间
                                          1000ms
                                          内存
                                          256MiB
                                          难度
                                          7
                                          标签
                                          递交数
                                          271
                                          已通过
                                          69
                                          上传者