当前位置: 首页 > news >正文

做特卖的网站雅美盛典翻译网站建设方案

做特卖的网站雅美盛典,翻译网站建设方案,工业设计考研可以考什么专业,网站做qq链接解题思路 由于最后返回一个01字符串表示所选人的状态要求人数最少,即字符串长度最少而要用最少的字符,找出则返回的字符为二进制下的编号这样利用了所有的01字符号人表示二进制下位的情况注意对于2的次方项,只需要有位,可以用位均…

解题思路

  • 由于最后返回一个01字符串表示所选人的状态
  • 要求人数最少,即字符串长度最少
  • 而要用最少的字符,找出Bad\ juice
  • 则返回的字符为二进制下Bad\ juice的编号
  • 这样利用了所有的01字符
  • i号人表示二进制下i位的情况
  • 注意对于2的次方项n=2^k,只需要有k-1位,n可以用k-1位均为0表示
import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;public class Main{static long md=(long)998244353;static long Linf=Long.MAX_VALUE/2;static int inf=Integer.MAX_VALUE/2;static class Node{int x;int y;public Node(int u,int v) {x=u;y=v;}}public static void main(String[] args) throws IOException{
//		AReader input=new AReader();
//	    PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));	Scanner input=new Scanner(System.in);int n=input.nextInt();//返回的二进制字符串即为变质的编号int t=0;while((1<<t)<n)t++;System.out.println(t);int[] c=new int[n+1];for(int i=0;i<t;++i) {for(int j=1;j<=n;++j) {if(((j>>i)&1)==1)c[i]++;}}for(int i=0;i<t;++i) {System.out.print(c[i]);for(int j=1;j<=n;++j) {if(((j>>i)&1)==1)System.out.print(" "+j);}System.out.println();}String string=input.next();char[] s=string.toCharArray();int ans=0;for(int i=0;i<t;++i) {if(s[i]=='1')ans|=(1<<i);}if(ans==0)ans=n;System.out.println(ans);System.out.flush();
// 	    out.flush();
//	    out.close();}//System.out.println();//out.println();staticclass AReader{ BufferedReader bf;StringTokenizer st;BufferedWriter bw;public AReader(){bf=new BufferedReader(new InputStreamReader(System.in));st=new StringTokenizer("");bw=new BufferedWriter(new OutputStreamWriter(System.out));}public String nextLine() throws IOException{return bf.readLine();}public String next() throws IOException{while(!st.hasMoreTokens()){st=new StringTokenizer(bf.readLine());}return st.nextToken();}public char nextChar() throws IOException{//确定下一个token只有一个字符的时候再用return next().charAt(0);}public int nextInt() throws IOException{return Integer.parseInt(next());}public long nextLong() throws IOException{return Long.parseLong(next());}public double nextDouble() throws IOException{return Double.parseDouble(next());}public float nextFloat() throws IOException{return Float.parseFloat(next());}public byte nextByte() throws IOException{return Byte.parseByte(next());}public short nextShort() throws IOException{return Short.parseShort(next());}public BigInteger nextBigInteger() throws IOException{return new BigInteger(next());}public void println() throws IOException {bw.newLine();}public void println(int[] arr) throws IOException{for (int value : arr) {bw.write(value + " ");}println();}public void println(int l, int r, int[] arr) throws IOException{for (int i = l; i <= r; i ++) {bw.write(arr[i] + " ");}println();}public void println(int a) throws IOException{bw.write(String.valueOf(a));bw.newLine();}public void print(int a) throws IOException{bw.write(String.valueOf(a));}public void println(String a) throws IOException{bw.write(a);bw.newLine();}public void print(String a) throws IOException{bw.write(a);}public void println(long a) throws IOException{bw.write(String.valueOf(a));bw.newLine();}public void print(long a) throws IOException{bw.write(String.valueOf(a));}public void println(double a) throws IOException{bw.write(String.valueOf(a));bw.newLine();}public void print(double a) throws IOException{bw.write(String.valueOf(a));}public void print(char a) throws IOException{bw.write(String.valueOf(a));}public void println(char a) throws IOException{bw.write(String.valueOf(a));bw.newLine();}}
}

 

http://www.yayakq.cn/news/791809/

相关文章:

  • 网站建设的总体设计概图郑州网站建设一汉狮网络
  • 网站建设简历wordpress防止攻击
  • 南宁网站建设 传导企业型网站制作
  • 做网站公司关键词ae免费模板下载网站
  • 邢台学校网站建设解决方案网站排名
  • 火车站网站建设方案上海公共招聘网手机版
  • 网站设计论文参考文献山东泰润建设集团网站
  • 网站 外包合同阿里巴巴网站建设的背景
  • 网站ip做网站wordpress更新的文章编辑器不好用
  • 沙发网站建设苏州seo网站诊断
  • 网站建设性能分析wordpress cms列表
  • 珠海市横琴新区建设环保局网站在线看视频网站怎么做
  • 网站建设和网站开发的区别珠海企业建站
  • 湛江个人网站建设青岛做网站哪个最好
  • 汉中网站建设wordpress 微博功能
  • 网站建设 办公系统网站建设的流程ppt
  • 本地高端网站建设信息大全哈尔滨建站多少钱
  • 企业网站建设的成本wordpress下载权限
  • 网站1g空间多少钱asp网站如何改首页布局视频教程
  • 公司网站有哪些重要性资源机
  • 专业海外网站推广Wordpress 缓存策略
  • 苏州做网站公司 询苏州聚尚网络韩国导航地图app
  • 二维码制作网站链接wordpress留言标签
  • 网页制作企业网站作业wordpress评论折叠
  • 岳阳网站设计温州网站开发风格
  • 基于phpmysql的网站开发一站式做网站哪家专业
  • 网站建设哪家有实力网站做百度竞价引流费用多少钱
  • 青浦区网站建设wordpress前台弹窗
  • 长沙网站提升排名网站建设回龙观
  • 苏州网站建设外贸网络公司注册资金多少