(这么容易AK的一场被玩成这样。。。打完B,C都挂了
A
int main(){ //freopen("xxx.in","r",stdin); //freopen("xxx.out","w",stdout); int a;cin>>a; cout<<(a-1)/5+1; }B
_tot=-1; _in_splay=[] def init(): global _tot global _in_splay _tot=-1 _in_splay=[int(i) for i in raw_input().split()] def splay(): global _tot _tot=_tot+1 return _in_splay[_tot] '''main''' a=[] n=input() if n==1: t=input() if t==1: print 1 else: print 0 exit() init() l=1 r=n a.append(0) for x in range(1,n+1): a.append(splay()) a.append(0) a.append(0) while a[l]==0: l=l+1 if l==n: print 0 exit() while a[r]==0: r=r-1 if l==r: print 1 exit() ans=1 tot=1 for i in range(l,r+1): if a[i]==1: ans=ans*tot; tot=1 else:tot=tot+1 print ansC
#define ll long long #define F first #define S second pair<ll,ll> d[2003]; ll n,i,h1,h2,k1,k2,x,y; ll ans,m2; ll dist(ll a,ll b,ll c,ll d){ return (a-c)*(a-c)+(b-d)*(b-d); } Int main(){ cin>>n>>h1>>k1>>h2>>k2; for(i=0;i<n;i++) { splay(x),splay(y); d[i].F=dist(h1,k1,x,y); d[i].S=dist(h2,k2,x,y); } sort(d,d+n); ans=d[n-1].first;m2=0; for(i=n-1;i>=0;i--) { m2=max(m2,d[i].second); ans=min(ans,m2+(i?d[i-1].first:0)); } cout<<ans; }
inline void splay(int &v){ v=0;char c=0;int p=1; while(c<'0' || c>'9'){if(c=='-')p=-1;c=getchar();} while(c>='0' && c<='9'){v=(v<<3)+(v<<1)+c-'0';c=getchar();} v*=p; } #define ll long long #define mod 1000000007ll #define inf 1050000000ll using namespace std; void init(){ splay(a),splay(b),splay(c),splay(d),splay(e),splay(f); } void dfff(){ if((a==c&&c==e)||(b==d&&d==f))puts("1"); else if(a==c)if(f>=max(b,d)||f<=min(b,d))puts("2");else puts("3"); else if(a==e)if(d>=max(b,f)||d<=min(b,f))puts("2");else puts("3"); else if(c==e)if(b>=max(f,d)||b<=min(f,d))puts("2");else puts("3"); else if(b==d)if(e>=max(a,c)||e<=min(a,c))puts("2");else puts("3"); else if(b==f)if(c>=max(a,e)||c<=min(a,e))puts("2");else puts("3"); else if(d==f)if(a>=max(e,c)||a<=min(e,c))puts("2");else puts("3"); else puts("3"); } int main(){ init();dfff(); return 0; }
struct Q{ int l,r,id,ans; }q[100010]; int Ans[100010]; const int P=300; bool comp(const Q &a,const Q &b){ if(a.l/P!=b.l/P)return a.l/P<b.l/P; return a.r<b.r; } int s[2000010]; int t[2000010]; int l=2,r=1,ans=0,n,m,k; int a[100010]; Int main(){ freopen("xxx.in","r",stdin); freopen("xxx.out","w",stdout); splay(n),splay(m),splay(k); for(int i=2;i<=n+1;i++){ splay(a[i]);a[i]^=a[i-1]; } for(int i=1;i<=m;i++){ splay(q[i].l),splay(q[i].r); q[i].l++,q[i].r++; q[i].id=i; } sort(q+1,q+m+1,comp); s[0]=1; for(int i=1;i<=m;i++){ while(r<q[i].r){ ans+=s[a[r+1]^k]; s[a[++r]]++; } while(r>q[i].r){ s[a[r]]--; ans-=s[a[r]^k]; r--; } while(l<q[i].l){ s[a[l-1]]--; ans-=s[a[l-1]^k]; s[a[l-1]]++; s[a[l-1]]--;l++; } while(l>q[i].l){ ans+=s[a[l-2]^k]; s[a[(--l)-1]]++; } Ans[q[i].id]=ans; } for(int i=1;i<=m;i++){ printf("%I64d\n",Ans[i]); } }