Afişează mesaje
Pagini: [1]
1  infoarena - concursuri, probleme, evaluator, articole / Arhiva educationala / Salutare! : Decembrie 01, 2014, 17:18:23
Salutare tuturor!
Sunt nou pe aici si am gasit o problema foarte interesanta.
Are cineva vreo idee de rezolvare? Brick wall Confused Think Think Eh?
2  infoarena - concursuri, probleme, evaluator, articole / Arhiva de probleme / Răspuns: 008 Cifra : Noiembrie 20, 2013, 20:02:51
De ce nu merge nu inteleg.Poate vede cineva?
#include <iostream>
#include <fstream>
using namespace std;
int main()
{ifstream f("cifra.in");
ofstream g("cifra.out");
int n,i,x,j,m;
f>>n;
for(i=1;i<=n;i++)
   {f>>x;
m=0;
for(j=1;j<=x;j++)
{if(j%10==1 || j%10==5 || j%10==6)
m=(m+j%10)%10;
   if(j%10==4 || j%10==9)
      if(j%2==1)
      m=(m+j%10)%10;
   else
      m=(m+j*j)%10;
   if(j%10==7 ||j%10== 8 || j%10==2 || j%10==3)
   if(j%4==1)
         m=(m+j)%10;
   else
      if(j%4==2)
            m=(m+j*j)%10;
         else

if(j%4==3)
   m=(m+(j*j*j)%10)%10;
else
if(j%4==0)
   m=(m+(j*j*j*j))%10;}
g<<m<<'\n';}
}
3  infoarena - concursuri, probleme, evaluator, articole / Arhiva de probleme / Răspuns: 046 Text : Octombrie 26, 2013, 20:11:29
Salut tocmai am facut problema dar imi spune ca nu este buna.Vedeti careva vreo greseala ?
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{ifstream f("text.in");
ofstream g("text.out");
char s[256];
unsigned i,n=0,m=0,k;
f.get(s,256);
for(i=0;i<strlen(s);i++)
   {if(s<='z' && 'a'<=s || 'A'<=s && s<='Z')
      n=n+1;
      if(s==' ')
         m=m+1;
          if(s=='-')
      if((s[i-1]<='z'&& 'a'<=s[i-1] || 'A'<=s[i-1] && 'Z'<=s[i-1])&&(s[i+1]<='z'&& 'a'<=s[i+1] || 'A'<=s[i+1] && 'Z'<=s[i+1]))
         m=m+1;}
k=(int)n/m;
g<<k;}
Pagini: [1]
Powered by SMF 1.1.19 | SMF © 2006-2013, Simple Machines