The Fourth Dimension Space

枯叶北风寒,忽然年以残,念往昔,语默心酸。二十光阴无一物,韶光贱,寐难安; 不畏形影单,道途阻且慢,哪曲折,如渡飞湍。斩浪劈波酬壮志,同把酒,共言欢! -如梦令

POJ 3425-Customer support 水题

根据题目直接做就好了,没什么要说的,一次AC;
//This is the Source Code for POJ 3425
#include<iostream>
#include
<cmath>
#include
<cstring>
using namespace std;

int f[1000001];
int main ()
{

    
int n;
    
int a,b,c;
    
int sum=0;
    
int i;
    
while(scanf("%d",&n)!=EOF)
    
{
        memset(f,
0,sizeof(f));
        sum
=0;
        
for(i=1;i<=n;i++)
        
{
            scanf(
"%d%d%d",&a,&b,&c);
            
if(b==0)
            
{
                sum
+=10;
                
continue;
            }

            
else if(b==1&&c==0)
            
{
                
if(f[a]==0)
                
{
                    sum
+=20;
                    f[a]
=1;
                }


                
else if(f[a]==1)
                
{
                    sum
+=30;


                }

            }

            
else if(b==1&&c==1)
            
{
                
if(f[a]==0)
                
{
                    sum
+=40;
                    f[a]
=1;
                }

                
                
else if(f[a]==1)
                
{
                    sum
+=50;
                    
                    
                }

            }

        }

        printf(
"%d\n",sum);
    }

    
return 0;
}

posted on 2009-03-06 22:03 abilitytao 阅读(789) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理