标签:cli ret 使用 display += cin div codeforce set
https://codeforces.com/contest/620
#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c,d; cin >> a >> b; cin >> c >> d; a = max(abs(a-c),abs(b - d)); cout << a << endl; return 0; }
AC代码
#include<bits/stdc++.h> using namespace std; int st[20] = {6,2,5,5,4,5,6,3,7,6}; int main(){ int a,b; cin >> a >> b; int sum = 0; for(int i = a; i <= b ; i++){ int x = i; while(x){ sum += st[x % 10]; x /= 10; } } cout << sum << endl; return 0; }
AC代码
#include<bits/stdc++.h> using namespace std; typedef long long ll; # define IOS ios::sync_with_stdio(false); cin.tie(0);cout.tie(0) //struct note{ // int x ,y; //}st[300000 + 10]; set<ll> s1,s2; ll a[300000 + 10][2]; int main(){ IOS; ll n; cin >> n; ll k = 0; ll z = 1; for(int i = 1 ; i <= n ;i ++ ){ ll t ; cin >> t; // s1.insert(t); if(!s1.count(t) ) //st[t].x = t,st[t].y = i; s1.insert(t); else a[k][0] = z , a[k][1] = i ,k++,s1.clear(),z = i + 1; } if(k) cout << k << endl; if(!k){ cout << -1 << endl; return 0; } if(a[k -1 ][1] != n ) a[k-1][1] = n ; for(int i = 0 ; i < k;i++){ cout << a[i][0] << " " << a[i][1] << endl; } //return 0; return 0; }
Educational Codeforces Round 6
标签:cli ret 使用 display += cin div codeforce set
原文地址:https://www.cnblogs.com/Agnel-Cynthia/p/10651612.html