zoukankan      html  css  js  c++  java
  • Atcoder abc 139

    A

    #include <bits/stdc++.h>
     
    using namespace std ;
    string s , t ;
    int num ;
    int main () {
    	cin >> s >> t ;
    	for(int i = 0 ; i < s.size() ; i ++) {
    		if(s[i] == t[i]) num ++ ;
    	}
    	cout << num << endl ;
    	return 0 ;
    }	
    

    B

    #include <bits/stdc++.h>
     
    using namespace std ;
    int n , m , ans = 0 ;
    int main () {
    	cin >> n >> m ;
    	if(m == 1) {
    		cout << 0 << endl ;
    		return 0 ;
    	}
    	int c = 1 ;
    	while(c < m) {
    		c += n-1 ;
    		ans ++ ;
    	}
    	cout << ans << endl ;
    	return 0 ;
    }	
    

    C

    #include <bits/stdc++.h>
     
    using namespace std ;
    int n , m , ans = 0 ,a[120000] ;
    int main () {
    	cin >> n ;int maxx = 0 , ans = 0 ;
    	for(int i = 1 ; i <= n ; i ++) {
    		cin >> a[i] ;
    		if(a[i] <= a[i-1]) maxx ++ , ans = max(maxx,ans) ;
    		else maxx = 0 ;
    	}
    	cout << ans << endl ;
    	return 0 ;
    }	
    

    D

    #include <bits/stdc++.h>
     
    using namespace std ;
    #define int long long
    int n , m , ans = 0 ;
    signed main () {
    	cin >> n ;
    	cout << n*(n-1)/2 << endl ;
    	return 0 ;
    }	
    

    E

    #include <bits/stdc++.h>
    #define int long long
    #define maxn 1000010
    using namespace std ;
    struct dy {
    	int y , next ;
    }A[maxn];
    int n , num , cnt , tot, ans ;
    int head[maxn] , a[1010][1010] , vis[1010][1010] ;
    int in[maxn] , t[maxn] , day[maxn] ;
    void add(int u,int v) {
    	A[++cnt].y = v ;
    	A[cnt].next = head[u] ;
    	head[u] = cnt ;
    	return ;
    }
    void topsort() {
    	for(int i = 1 ; i <= tot ; i ++) {
    		int u = t[i] ;
    		for(int j = head[u] ; j ; j = A[j].next) {
    			int v = A[j].y ;
    			day[v] = day[u] + 1 ;
    			in[v] -- ;
    			if(!in[v])
    				t[++tot] = v ;
    		}
    	}
    	for(int i = 1 ; i <= num ; i ++)
    		 ans=max(ans,day[i]);
    	return;
    }
    signed main() {
    	scanf("%d",&n);
    	for(int i = 1 ; i <= n ; i ++) {
    		for(int j = 1 ; j < n ; j ++) {
    			scanf("%d",&a[i][j]) ;
    			if(!vis[i][j]&&!vis[j][i]) 
    				vis[i][j] = vis[j][i] = ++num ;
    		}
    	}
    	for(int i = 1 ; i <= n ; i ++) {
    		for(int j = 2 ; j < n ; j ++) {
    			add(vis[i][a[i][j-1]],vis[i][a[i][j]]);
    			in[vis[i][a[i][j]]] ++ ;
    		}
    	}
    	for(int i = 1 ; i <= num ; i ++)
    	  if(!in[i]) {
    	  	t[++tot] = i ;
    	  	day[i] = 1 ;
    	  }
    	topsort() ;
    	if(tot != num) puts("-1");
    	else printf("%d
    ",ans);
    	return 0;
    }
    
  • 相关阅读:
    ASP.NET伪静态配置
    拖动条控件 (UISlider)
    进度环控件 (UIActivityIndicatorView)
    进度条控件 (UIProgressView)
    图像控件 (UIImageView)
    分段控件 (UISegmentedControl)
    CocoaPods安装和使用教程
    iOS 在UILabel显示不同的字体和颜色
    iOS开源项目(新)
    iOS开源项目(旧)
  • 原文地址:https://www.cnblogs.com/lyt020321/p/11444033.html
Copyright © 2011-2022 走看看