11 条题解

  • 0
    @ 2024-12-25 20:14:34

    #include<bits/stdc++.h> using namespace std; int a[1005]; int main() { int n; cin >>n; for(int i=1;i<=n;i++)

    cin>>a[i]; for(int i=1;i<=n;i++) { int sum=0; for(int j=1;j<=i;j++) if(a[j]<a[i]) sum++; cout<<sum<<" "; } return 0; }

    • 0
      @ 2024-12-25 20:03:31
      #include<bits/stdc++.h>
      using namespace std;
      int a[1005][1005];
      int main()
      {
      	int n,m;
      	cin>>n>>m;
      	for(int i=1;i<=n;i++)
      	{
      		for(int j=1;j<=m;j++)
      		{
      			cin>>a[i][j];
      		}
      	}
      	for(int i=1;i<=n;i++)
      	{
      		for(int j=1;j<=m;j++)
      		{
      			if(a[i][j]!=0)
      			{
      				cout<<i<<" "<<j<<" "<<a[i][j]<<endl;
      			}
      		}
      	}
      }
      
      • 0
        @ 2024-12-25 20:00:03

        #include<bits/stdc++.h> using namespace std; int y[11111][11111]; int main() { int n; cin>>n; y[0][0]=1; for(int i=1;i<=n;i++) { for(int j=1;j<=i;j++) { y[i][j]=y[i-1][j]+y[i-1][j-1]; cout<<y[i][j]<<" "; } cout<<endl; } return 0; }

        • 0
          @ 2024-12-25 19:30:56

          #include<bits/stdc++.h> using namespace std; int r[11111]; int main() { double n,z=0,p=0,m=0; cin>>n; for(int i=1;i<=n;i++) { cin>>r[i]; z+=r[i]; } p=z/n; for(int i=1;i<=n;i++) { if(r[i]<p) { m++; } } cout<<m; }

          • 0
            @ 2024-12-25 19:30:43

            #include<bits/stdc++.h> using namespace std; int r[11111]; int main() { double n,z=0,p=0,m=0; cin>>n; for(int i=1;i<=n;i++) { cin>>r[i]; z+=r[i]; } p=z/n; for(int i=1;i<=n;i++) { if(r[i]<p) { m++; } } cout<<m; }

            • 0
              @ 2024-12-25 19:29:09
              #include<bits/stdc++.h>
              using namespace std;
              int a[1005][1005];
              int main()
              {
              	int n,m;
              	cin>>n>>m;
              	for(int i=1;i<=n;i++)
              	{
              		for(int j=1;j<=m;j++)
              		{
              			cin>>a[i][j];
              		}
              	}
              	for(int i=1;i<=n;i++)
              	{
              		for(int j=1;j<=m;j++)
              		{
              			if(a[i][j]!=0)
              			{
              				cout<<i<<" "<<j<<" "<<a[i][j]<<endl;
              			}
              		}
              	}
              }
              
              • 0
                @ 2024-11-19 20:21:06
                #include<bits/stdc++.h>
                using namespace std;
                int main(){
                    long long a,b,p,res=1;
                    scanf("%ld%ld%ld",&a,&b,&p);
                    while(b!=0){
                        if(b&1){
                            res=res*a%p;
                        }
                        a=a*a%p;
                        b>>=1;
                    }
                    printf("%ld\n",res%p);
                    return 0;
                }
                
                • 0
                  @ 2024-10-17 21:24:34

                  知识点:快速幂

                  /*
                  int      %o/%lo(八进制) %d/%i/%ld/%li(十进制) %x/%lx(十六进制)[如标名为o/lo/d/i/lo/li/x/lx即输出为八进制/十进制/十六进制]
                  longlong %lld
                  float    %f/%e
                  double   %lf/%le
                  char     %c
                  char[]   %s
                  'a'=97
                  'z'=122
                  'A'=65
                  'Z'=90
                  '0'=48
                  '9'=57
                  */
                  #include <iostream>
                  #include <iomanip>
                  #include <cmath>
                  #include <cstdio>
                  #include <cstring>
                  #include <algorithm>
                  #include <ctime>
                  #include <limits>
                  #include <assert.h>
                  #include <stdlib.h>
                  using namespace std;
                  #define LL long long
                  #define ull unsigned long long
                  const int N=1e5+10;
                  const int INF=0x3f3f3f3f;
                  const double pi=3.1416;
                  LL a,b,p;
                  long long power(long long a,long long b,long long p){
                  	long long ans=1;
                  	long long wp=a;
                  	while(b){
                  		if(b&1){
                  			ans=ans*wp%p;
                  		}
                  		b>>=1;
                  		wp=wp*wp%p;
                  	}
                  	return ans%p;
                  }
                  int main(){
                  	cin>>a>>b>>p;
                  	cout<<power(a,b,p)<<endl;
                  return 0;
                  }
                  
                  • -2
                    @ 2023-4-23 20:48:48
                    /*****************************************
                    备注:数学nanhai 5 
                    ******************************************/
                    #include <queue>
                    #include <math.h>
                    #include <stack>
                    #include <stdio.h>
                    #include <iostream>
                    #include <vector>
                    #include <iomanip>
                    #include <string.h>
                    #include <algorithm>
                    using namespace std;
                    #define LL long long
                    const int N = 1e5 + 10;
                    const int INF = 0x3f3f3f3f;
                    LL power(LL n , LL m , LL p)
                    {
                    	if(n == 0)
                    		return 0;
                    	LL ans = 1;
                    	while(m)
                    	{
                    		if(m&1)
                    			ans = (ans * n) %p;
                    		m >>= 1;
                    		n = (n*n)%p;
                    	}
                    	return ans%p;
                    }
                    int main()
                    {
                    	LL n , m , p;
                    	cin >> n >> m >> p;
                    	cout << power(n , m , p);
                    	return 0;
                    }
                    
                    • -7
                      @ 2023-5-29 17:45:56

                      1+1=2 a的b次方 是a×b次a

                      • -9
                        @ 2023-5-7 19:38:36

                        #include<bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b << endl; return 0; }

                      • 1

                      信息

                      ID
                      2
                      时间
                      1000ms
                      内存
                      128MiB
                      难度
                      8
                      标签
                      递交数
                      3025
                      已通过
                      465
                      上传者