精华内容
下载资源
问答
  • D1164:Easier Done Than Said?

    2019-09-24 14:20:07
    描述Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-generated passwo...
    描述
    Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-generated passwords (like xvtpzyo), but users have a hard time remembering them and sometimes leave them written on notes stuck to their computer. One potential solution is to generate "pronounceable" passwords that are relatively secure but still easy to remember.

    FnordCom is developing such a password generator. You work in the quality control department, and it's your job to test the generator and make sure that the passwords are acceptable. To be acceptable, a password must satisfy these three rules:

    It must contain at least one vowel.

    It cannot contain three consecutive vowels or three consecutive consonants.

    It cannot contain two consecutive occurrences of the same letter, except for 'ee' or 'oo'.

    (For the purposes of this problem, the vowels are 'a', 'e', 'i', 'o', and 'u'; all other letters are consonants.) Note that these rules are not perfect; there are many common/pronounceable words that are not acceptable.

    输入
    The input consists of one or more potential passwords, one per line, followed by a line containing only the word 'end' that signals the end of the file. Each password is at least one and at most twenty letters long and consists only of lowercase letters.
    输出
    For each password, output whether or not it is acceptable, using the precise format shown in the example.
    样例输入
    a tv ptoui bontres zoggax wiinq eep houctuh end
    样例输出

    is acceptable.
    is not acceptable.
    is not acceptable.
    is not acceptable.
    is not acceptable.
    is not acceptable.
    is acceptable.
    is acceptable.

     

    思路:输入数据,每输入一个数据判断是否接受,如果有元音j++;a判断连续的元音个数,b判断连续的辅音个数,c判断除了“ee”或“oo”外是否有连续相同的两个字母,最后判断该单词是否可被接受。

    代码:

    #include
    #include
    using namespace std;
    int main()
    {
            char a[5]="end";
            char data[20];
            while(cin>>data)
            {
                    if(strcmp(data,a)==0)
                            return 0;
                    int i,j=0,a=0,b=0,c=0;
                    int n=strlen(data);
                    for(i=0;i
                    {
                           if(data[i]=='a'||data[i]=='e'||data[i]=='i'||data[i]=='o'||data[i]=='u')
                            {
                                    j++;
                                    a++;
                                    b=0;
                                    if(data[i]==data[i+1]&&data[i]!='e'&&data[i]!='o')
                                            c++;
                            }
                            else
                            {
                                    b++;
                                    if(data[i]==data[i+1]&&data[i]!='e'&&data[i]!='o')
                                            c++;
                                    a=0;
                            }
                            if(a==3||b==3)
                                    break;
                    }
                    if(j!=0&&c==0&&a<3&&b<3)
                            cout<<"<"<<data<<">"<<" is acceptable."<<endl;
                    else
                            cout<<"<"<<data<<">"<<" is not acceptable."<<endl;        
            }
            
            return 0;
    }

    转载于:https://www.cnblogs.com/Joazer/p/5239827.html

    展开全文
  • HDU1164

    2011-12-02 21:02:00
    HDU1164大意如下,任何一个数都可以分解为若干个素数的乘积;也就是代数定理。此题为一道水题,一次就AC了。首先可以利用素数够造一个素数表,之后将其素数因子挨个存储之后打印     #include"stdio.h" int d...
    HDU1164大意如下,任何一个数都可以分解为若干个素数的乘积;也就是代数定理。
    此题为一道水题,一次就AC了。首先可以利用素数够造一个素数表,之后将其素数因子挨个存储之后打印
     
     
    #include"stdio.h"
    int d[10000],count=0;
    int prime(int n)
    {
            int i;
            if(n!=2&&n%2==0||n!=3&&n%3==0||n!=5&&n%5==0||n!=7&&n%7==0)
                   return 0;
            else
            {
                   for(i=0;d[i]*d[i]<=n;i++)
                           if(n%d[i]==0)
                                   return 0;
            }
            return n>1;
    }
    void initprime()
    {
            int i;
            for(d[count++]=2,i=3;i<10000;i++)
            {
                   if(prime(i))
                           d[count++]=i;
            }
    }
    int main()
    {
            initprime();
            int n,i,a[10000];
            while(scanf("%d",&n)!=EOF)
            {
                   int total=0;
                   for(i=0;d[i]*d[i]<=n;i++)
                   {
                           if(n%d[i]==0)
                           {
                                   a[total++]=d[i];
                                   n/=d[i];
                                   while(n%d[i]==0)
                                   {
                                          a[total++]=d[i];
                                          n/=d[i];
                                   }
                           }
                   }
                   if(n>1)
                           a[total++]=n;
                   printf("%d",a[0]);
                   for(i=1;i<total;i++)
                           printf("*%d",a[i]);
                   printf("\n");
            }
            return 0;
    }
     
    

    展开全文
  • HDOJ1164

    2010-04-08 20:47:00
    http://acm.hdu.edu.cn/showproblem.php?pid=1164 #include int main() { int n,i,j,a[100],k; while (scanf("%d",&n)!=EOF) { i=2;

    http://acm.hdu.edu.cn/showproblem.php?pid=1164

     

     

     

    展开全文
  • hdu 1164

    2014-04-03 20:36:15
    题目大意:n各个位数相加,得到m,各个位数相加,直至只有1位,称为根。输入数n,求n^n根。 数字很大,找规律吧。 #include ... while(scanf("%d",&n)!=EOF&&n) { printf("%d\n",f[n%18]); }

    题目大意:n各个位数相加,得到m,各个位数相加,直至只有1位,称为根。输入数n,求n^n根。

    数字很大,找规律吧。

    #include <stdio.h>
    
    int main()
    {
    	int n,f[18]={9,1,4,9,4,2,9,7,1,9,1,5,9,4,7,9,7,8};
    
    	while(scanf("%d",&n)!=EOF&&n)
    	{
    		printf("%d\n",f[n%18]);
    	}
    
    	return 0;
    }


    展开全文
  • hdu1164

    2013-07-30 10:26:41
    原文链接:click here 这是一题分解素数的水题,用欧拉函数就可以做出来。 代码如下: /*利用欧拉函数把一个数进行素数分解*/ ...while(scanf("%d",&n)!=EOF) { for(j=0,i=2;i*i { if(n%i==0) { n=n/i;a[j++]=i;
  • HDU-1164

    2016-02-13 15:16:40
    #include #include using namespace std; bool pdss(int n);//判断素数 int zss(int n);//找最小素数 void print(int n);//打印素数 int main() ... while(scanf("%d",&N)!=EOF) { print(N); } return
  • P1164 小A点菜

    2019-01-21 10:30:00
    P1164 小A点菜 d[i][j] : 前i个菜刚好花费j元的方案数 int d[200][10008]; int main() { int n,m; cin>>n>>m; int v[200]; for(int i=1;i<=n;i++) cin>>v[i]; d[1][0...
  • 1164 暂时没思路

    2019-04-28 21:01:02
    AC代码 #include #include #include #include #define MAXN 100005 using namespace std; int n,m,a[MAXN],f[MAXN];...scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) scanf("%d",&a[i]); f[0...
  • 1164: 字符串加密

    2018-12-14 21:29:08
    1164: 字符串加密 #include&lt;stdio.h&gt; #include&lt;string.h&gt; int main() {  char a[100];  int k,c,i,s;  gets(a);  scanf("%d",&amp;k);  c=k%26;  s=strlen(a);  ...
  • hiho 1164 概论数学

    2017-10-05 19:44:06
    #include using namespace std; int main() { int n; while(scanf("%d",&n)!=EOF) printf("%d.000000\n",n+1); return 0; }
  • POJ 1164 The Castle

    2016-07-19 20:09:08
    #include #include #include #include using namespace std;...int d[55][55],vis[55][55]; int c; void dfs(int i,int j) { if(vis[i][j]) return ; c++; vis[i][j]=1; if(!(d[i][j]&1)) dfs(i,j-1);
  • [恢]hdu 1164

    2012-01-06 17:32:00
    2011-12-16 11:30:41 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1164 题意:分解素因子。。。 代码: # include <stdio.h>int main (){ int i, n, ... while (~scanf ("%d", &n)) { flag ...
  • <div><p>After https://github.com/rust-lang/docs.rs/pull/1164 I am seeing: <p><img alt="Peek 2020-12-09 00-18" src="https://img-blog.csdnimg.cn/img_convert/949d7931218a3565304d490dc99ba82d.gif" /></p> ...
  • hdu(1164)

    2013-08-09 11:32:11
    这题不利用素数更简单。。 #include"stdio.h" #include"string.h" int map[70000]; int main() ... while(scanf("%d",&m)!=EOF)  {  j=1;  for(i=2;i  {  while(m%i)  i++;  m=m/i;  map
  • HDU1164质因数分解

    2016-08-05 20:10:55
    #include int main(){ int n,i; while(scanf("%d",&n)!=EOF){ int flag=1; for(i=2;i*i;i++){ while(n%i==0){ if(flag){ print
  • luogu1164:小A点菜

    2019-07-25 20:55:51
    #include<bits/stdc++.h> using namespace std; int f[10010]; int main() ... scanf("%d %d",&n,&m); for(int i=1;i<=n;i++) { scanf("%d",&x); for(int j=m;j>...
  • Luogu P1164小A点菜

    2019-10-07 00:26:13
    大意:一共n种菜,每种菜有个价格w[i]。只有m元,问最多几种菜。 #include<cstdio> #include<algorithm> using namespace std;...int n,m,w[100005],dp... scanf("%d%d",&n,&m); for(int i=...
  • Luogu P1164 小A点菜

    2019-07-07 23:50:50
    #include <algorithm> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int f[10005]; int main () { int n,m;... scanf ("%d%d",&n,&...
  • #include"stdio.h" //精度需要注意 #include"iostream" using namespace std; typedef long long ll; int n,m[50],a[50]; void E_gcd(ll a,ll b,ll &d,ll &x,ll &y) { ...b) {d=a;... else{E_gcd(b,a%b,d,
  • ZZULIOJ1164: 字符串加密

    2021-04-14 10:59:45
    #include<stdio.h> #include<string.h> int main() { int i,k,len; char str[100]={0};... scanf("%d",&k); k=k%26; for(i=0;i<len;i++) { if(str[i]<'A'||(str[i]>'Z'&&
  • Problem 1164 Average is not Fast Enough!. 题意 计算平均成绩 min/km(一千米要跑多少分钟) 输入: 赛段数n(int 1<=n<=20),总赛程d(double 0<=d<=200) 队伍编号no,赛程1的成绩,赛程2的成绩,……...
  • 1164C语言实验——矩阵转置

    千次阅读 2013-12-09 23:24:33
    题目描述 输入N*N的矩阵,输出它的转置矩阵。 输入 第一行为整数N(1≤N≤100)。 接着是一个N*N的矩阵。 输出 转置矩阵。 示例输入 2 1 2 1 2 示例输出 ...int i,j,n,d[100][100];...scanf("%d
  • nyoj-1164-种植树苗

    2015-03-10 10:56:09
    种植树苗 时间限制:2000 ms | 内存限制:65535 KB 难度:2 ...但是,最近我们发现,如果...因此我们决定移除一些树苗,从而使任意两棵树苗的距离都不小于D,并且我们希望留下的树苗越多越好。 输入输入
  • 题目:求出1~N中与N互质的数的总和 分析:答案就是N∗φ(N)/2N∗φ(N)/2N*\varphi(N)/2 代码: #include &amp;lt;cstdio&amp;gt; #include &...%d&quot;,&amp;amp;n);
  • 题目描述Problem 1164 Average is not Fast Enough!解题思路整个赛道总长为d,分为n段接力,计算跑完整个赛道的平均速度。 因为 小时 的输入可能为数字或者为“-”,可以考虑存成字符。 注意结果要四舍五入。参考...
  • hdu 1164(一个数的素数因子)

    千次阅读 2012-11-02 20:19:56
    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1164 题目解析:题目做了很久、、其实不难啊 代码:#include #include #include #include #include #include ...using namespace std;... while(scanf("%d",
  • Code #include #define N 110 int main() { int a[N][N], n, i, j; scanf("%d",&n); for(i=0; i; i++) for(j=0; j; j++) scanf("%d",&a[i][j]); for(i=0; i; i++)

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 547
精华内容 218
关键字:

d1164