'ACM'에 해당되는 글 9건

  1. 2009.07.28 PC#9
  2. 2009.07.28 PC#11
  3. 2009.07.15 PC#3
2009.07.28 07:28

#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main()
{
 int count;
 
 vector<int> number;
 vector<int> sub;

 set<int> jolly;
 while(1){
  cin>>count;
 if(cin.eof()) return 0;
  for(int i=1;i<count;i++)
  {
   jolly.insert(i);
  }

  for(int i=0;i<count;i++)
  {
   int temp;
   cin>>temp;
   number.push_back(temp);   //count갯수만큼 벡터에 숫자 입력받음
   if(i>0)
   {
    int temp1;
    temp1=number[i]-number[i-1];
    sub.push_back(abs(temp1));
    jolly.erase(sub[i-1]);
   }
  }
  if(jolly.empty())
  {
   cout<<"Jolly"<<endl;
  }
  else
  {
   cout<<"Not jolly"<<endl;
  }
  jolly.clear();
  number.clear();
  sub.clear();
 }
 return 0;
}

'ACM' 카테고리의 다른 글

PC#9  (0) 2009.07.28
PC#11  (0) 2009.07.28
PC#3  (0) 2009.07.15
URI Decoding  (0) 2009.07.08
3n+1  (0) 2009.07.08
#1000  (0) 2009.06.24
Posted by hyunny82
2009.07.28 07:27
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main()

 const int Friday=6;
 const int Satday=7;
 const int WEEK=7;
 int testCount;
 int sum=0;
 cin>>testCount;
 set<int> huDay;
 while(testCount--)
 {
  int dayCount;     //총날짜
  int partyNum;     //정당수
  cin>>dayCount;
  cin>>partyNum;
  for(int i=1;i<partyNum+1;i++)
  {
   int temp;
   cin>>temp;     //각 정당 쉬는 날짜
   int temp1=temp;    //날짜 점프위한 임시변수
   while(temp<=dayCount){
    if((temp%7 !=0) &&((temp+1) %7 != 0)){
     huDay.insert(temp);
     temp+=temp1;  //현재날짜업뎃
    }
    else{
     temp+=temp1;
    }
   }
  }
  cout<<huDay.size()<<endl;
  huDay.clear();
  
//  partyCount.clear();
 }
 return 0;
}

'ACM' 카테고리의 다른 글

PC#9  (0) 2009.07.28
PC#11  (0) 2009.07.28
PC#3  (0) 2009.07.15
URI Decoding  (0) 2009.07.08
3n+1  (0) 2009.07.08
#1000  (0) 2009.06.24
Posted by hyunny82
2009.07.15 21:19

/* @BEGIN_OF_SOURCE_CODE */
/* @JUDEGE_ID: parkjaehyun 110103 C++ "simple loop" */
#include <iostream>
#include <vector>
#include <stdlib.h>
using namespace std;

int main(void)
{
 int numberOfStudent=0; //학생수
 float money=0;
 float average=0;
 float sum=0;
 float dis=0;
 float temp=0;
 cout.precision(2);
 vector<float>moneyOfStudent;
 cin>>numberOfStudent;
 while(numberOfStudent!=0)
 {
  for(int i=0;i<numberOfStudent;i++)
  {
   cin>>money;    //2자리까지만 밑으로 버림
   money*=100.0;
   temp=(int)money;
   temp/=100.0;
   moneyOfStudent.push_back(temp); //학생사용 돈 입력받음
   sum+=temp;
  }
  average=sum/numberOfStudent; //평균
  
  for(int i=0;i<numberOfStudent;i++)
  {
   if(moneyOfStudent[i]>average)
   {
    float temp2;
    temp=moneyOfStudent[i]-average;
    temp2=(int)(temp*100.0);
    temp2/=100.0;
    dis+=temp2;
   }

  }
  cout<<fixed<<"$"<<dis<<endl;

  //초기화
  average=0;
  dis=0;
  sum=0;
  temp=0;
  moneyOfStudent.clear();
  cin>>numberOfStudent;
 } 
}

/* @END_OF_SOURCE_CODE */

역시나 답대로 나오지만 틀린 답이란다..

뭔가 잘못된게 있는데 ... 찾지를 못하겠네 ;;

 

 

'ACM' 카테고리의 다른 글

PC#9  (0) 2009.07.28
PC#11  (0) 2009.07.28
PC#3  (0) 2009.07.15
URI Decoding  (0) 2009.07.08
3n+1  (0) 2009.07.08
#1000  (0) 2009.06.24
Posted by hyunny82
이전버튼 1 2 3 이전버튼

티스토리 툴바