zoukankan      html  css  js  c++  java
  • 卢斯进制(NOIP1998进制位)emm~

    //我的80分代码=_=(de不出来)(好像是"ERROR”的问题)

    #include<iostream>
    #include <cstring>
    #include<algorithm>
    #include <cstdio>
    using namespace std;
    char tmp[1000];
    char str[9];
    int used[9];
    int main()
    {
    int n;
    char c;
    scanf("%d +", &n);
    n--;
    for(int i=0;i<n;i++)
    {
    scanf(" %c", &c);
    str[i] = c;
    }
    for(int i = 0; i < n; i++)
    {
    scanf(" %c", &c);
    for(int j = 0; j < n; j++)
    {
    scanf(" %s", tmp);
    if(strlen(tmp) == 1)
    {
    for(int k = 0; k < n; k++)
    {
    if(str[k] == tmp[0])
    {
    used[k]++;
    break;
    }
    }
    }
    }
    }
    for(int j=0;j<=n;j++)
    {
    for(int k=j+1;k<=n;k++)
    {
    if(used[j]==used[k])
    {
    puts("ERROR!");
    return 0;
    }
    }
    }
    for(int i = 0; i < n-1; i++)
    {
    printf("%c=%d ", str[i], used[i] - 1);
    }
    printf("%c=%d ", str[n-1], used[n-1] - 1);
    printf("%d ",n);
    return 0;
    }

    //std60分代码=_=

    #include <cstdio>
    #include <cstring>
    #include <cstdlib>
    #include<iostream>
    using namespace std;
    char tmp[1000];
    char str[9];
    int used[9];

    int main(){

    freopen("lusi.in","r",stdin);
    freopen("lusi.out","w",stdout);
    int i,j,k,n;
    char c;
    scanf("%d +", &n);
    n--;
    for(i=0;i<n;i++){
    scanf(" %c", &c);
    str[i] = c;
    }
    for(i = 0; i < n; i++){
    scanf(" %c", &c);
    for(j = 0; j < n; j++){
    scanf(" %s", tmp);
    if(strlen(tmp) == 1){
    for(k = 0; k < n; k++){
    if(str[k] == tmp[0]){
    used[k]++;
    break;
    }
    }
    }
    }
    }
    for(i = 0; i < n-1; i++){
    printf("%c=%d ", str[i], used[i] - 1);
    }
    printf("%c=%d ", str[n-1], used[n-1] - 1);
    printf("%d ",n);
    return 0;
    }

    //同思路AC代码

    #include<bits/stdc++.h>
    using namespace std;

    #define go(i,a,b) for(int i=a;i<=b;++i)

    char a[10][10][5];
    int n,g[300];

    int main(){
    cin>>n;
    go(i,1,n)
    go(j,1,n)
    scanf("%s",a[i][j]);
    go(i,2,n)
    go(j,2,n){
    if(strlen(a[i][j])==1){
    ++g[a[i][j][0]];
    }
    }
    go(i,2,n)
    go(j,2,n){
    int x=g[a[i][1][0]]-1,y=g[a[1][j][0]]-1;
    int z=0;
    int l=strlen(a[i][j]);
    go(k,0,l-1){
    int val=g[a[i][j][k]]-1;
    z=z*(n-1)+val;
    }
    if(x+y!=z){
    puts("ERROR!");
    return 0;
    }
    }
    go(i,2,n){
    putchar(a[1][i][0]);
    putchar('=');
    printf("%d ",g[a[1][i][0]]-1);
    }
    putchar(' ');
    printf("%d",n-1);
    return 0;
    }

  • 相关阅读:
    前端H5
    nginx的location的匹配规则
    非旺玖原装的PL2303,请联系您的供货商
    Arduino 怎样添加第三方拓展
    Arduino的shiftOut函数作用
    arduino 的analogRead() 和analogWrite()
    composer安装TP的时候:错误提示:zsh: no matches found: 5.1.*
    Bootstrap3 模态框点击无效
    人人商城支付成功后在哪修改订单状态
    人人商城怎样判断订单是否支付
  • 原文地址:https://www.cnblogs.com/Chri-K/p/13758120.html
Copyright © 2011-2022 走看看