Codeforces Round #253 (Div. 1)-A,B_html/css_WEB-ITnose
Question A:
From the meaning of the question, it can be turned over up to 10 times (in fact, 8 times is enough), then we use state compression to represent the state.
For a certain state, if a certain bit is 0, it means that this bit is not turned over, otherwise it means that this bit is turned over.
For a certain flip state:
If there is G3 in the card, then connect G and 3. The other connected edges are similar, don’t repeat the edges.
For the two endpoints of any edge, there are three situations to discuss:
1. If both endpoints are turned over, then it is obvious that this card is represented.
2, only one of the two endpoints is turned over, then the corresponding num is increased by 1.
3, both endpoints are not turned over, and the counter tt is increased by 1.
For any state:
1, if the counter tt is greater than 1, then all cards cannot be determined.
2. If the num number of any endpoint is greater than 1, then it will definitely not be able to determine all the cards.
3, otherwise, this state can represent all cards.
#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>#include<vector>using namespace std;#define LL __int64#define maxn 2201int num[20];int pan[220];int name[22001];vector<int>vec;int map[110][110];void dos(int x){ while(x) { cout<<x%2; x=x/2; } cout<<endl;}int main(){ int n,l,r,x,y; char str[1010]; pan['R']=6; pan['G']=7; pan['B']=8; pan['Y']=9; pan['W']=5; while(~scanf("%d",&n)) { memset(num,0,sizeof(num)); memset(name,0,sizeof(name)); memset(map,0,sizeof(map)); l=r=0; for(int i=1; i<=n; i++) { scanf("%s",str); x=pan[str[0]]; y=str[1]-'1'; map[x][y]++; map[y][x]++; } int st=0; int minn =10; for(int st=0; st<(1<<10); st++) { int ss=0; for(int j=0; j<10; j++) { if(st&(1<<j))ss++; } if(ss>=minn)continue; int leap=0; int t=0; memset(num,0,sizeof(num)); for(int j=5; j<10; j++) { for(int i=0; i<5; i++) { if(map[i][j]) { if((st&(1<<i))&&(st&(1<<j)))continue; if((st&(1<<i))||(st&(1<<j))) { if(st&(1<<i)) { if(!num[i]) { num[i]++; continue; } } if((st&(1<<j))) { if(!num[j]) { num[j]++; continue; } } } else { if(t==0) { t++; continue; } } leap++; } } } if(!leap) { minn=min(minn,ss); // cout<<" "<<ss<<" "; // dos(st); } } cout<<minn<<endl; } return 0;}
For the current selected state,
p0 represents the probability of 0 people telling the answer.
p1 represents the probability of one person telling the answer.
For the person you are about to face:
a represents the probability of 0 people telling the answer.
b represents the probability of 1 person telling the answer.
If the value of p1 becomes smaller after accepting this person, then it should not be accepted.#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>#include<vector>using namespace std;#define LL __int64#define maxn 2201double num[maxn];int main(){ int n; double x; while(~scanf("%d",&n)) { for(int i=1;i<=n;i++) { scanf("%lf",&num[i]); } sort(num+1,num+n+1); double ans=0; double a=1; double c,d; double b=0; for(int i=n;i>=1;i--) { c=a; d=b; b=b+a*num[i]-b*num[i]; a=a-a*num[i]; if(b<d) { b=d; break; } } printf("%.10lf\n",b); } return 0;}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...
