top of page

게시판 게시물

최준우
2024년 4월 28일
In 소스 코드 제출
/* #include <stdio.h> int main() { int p[100001]={}; // p[i] =0 : i°¡ ¼Ò¼ö´Ù int n; int i,j; int max=0; scanf("%d",&n); for(i=2 ; i*i<=n ; i++) { if(p[i]==0) { for(j=i*i ; j<=n ; j+=i) { p[j]=1; } } } for(i=2 ; n!=1 ; i++) { if(p[i]==0) { while(1) { if(n%i==0) { if(i>max) { max=i; } n=n/i; } else { break; } } } } printf("%d",max); return 0; } */ /* #include <stdio.h> int main() { long long int n; long long int arr[100001] = {}; long long int max = 0; long long int sum = 0; scanf("%lld", &n); for(long long int i=2; i*i<=n; i++) { while(n%i == 0) { n/=i; sum++; if(sum>max) { max=i; } } sum=0; } if (n>1) { max=n; } printf("%lld", max); return 0; } */ /* #include <stdio.h> int main(){ long long int a = 1; int n,k; scanf("%d %d",&n,&k); for(int i=0 ; i<k ; i++){ a=(a*n)%1000000007; } printf("%lld", a); return 0; } */ /* #include<stdio.h> int main() { int n; int gt,ct; int cnt=0; int min=1001; scanf("%d",&n); for(int i=1 ; i<=n ; i++) { scanf("%d %d",&gt,&ct); if(gt<=ct && ct<min) { min=ct; } else if(gt>ct) { cnt++; } } if(cnt==n) { printf("-1"); return 0; } printf("%d",min); } */ /* #include<stdio.h> int pxy[9][2]={{-1,-1},{0,-1},{1,-1},{-1,0},{1,0},{-1,1},{0,1},{1,1}}; int arr[30][30]={}; void f(int i,int j) { int sum=0; for(int p=0;p<8;p++) { sum+=arr[i+pxy[p][0]][j+pxy[p][1]]; } if(arr[i][j]==0 && sum==3) { printf("1 "); } else if(arr[i][j]==1 && (sum>=4 || sum<=1)) { printf("0 "); } else if(arr[i][j]==1 && (sum==2 || sum==3)) { printf("1 "); } else { printf("0 "); } } int main() { for(int i=1 ; i<=25 ; i++) { for(int j=1 ; j<=25 ; j++) { scanf("%d",&arr[i][j]); } } for(int i=1 ; i<=25 ; i++) { for(int j=1 ; j<=25 ; j++) { f(i,j); } printf("\n"); } } */ /* #include<stdio.h> int stack[100001]={}; int top=-1; void push(int data) { top++; stack[top] = data; } int pop() { if(top!=-1) { return stack[top--]; } } int main() { int n,h; long long int sum=0; scanf("%d",&n); for(int i=1 ; i<=n ; i++) { scanf("%d",&h); while(top!=-1 && h>=stack[top]) { pop(); } sum+=(top+1); push(h); } printf("%lld",sum); } */ /* #include<stdio.h> int main() { int a,b; int sum=0; int num; int arr[10]={0,1,2,3,2,1,2,3,3,2}; scanf("%d %d",&a,&b); num=a>b? a-b:b-a; sum+=num/10; num%=10; sum+=arr[num]; printf("%d",sum); } */ /* #include<stdio.h> int main() { int k,n; int ism; int sum=0; scanf("%d %d",&k,&n); for(int i=1 ; i<=k ; i++) { for(int j=1 ; j<=k ; j++) { scanf("%d",&ism); if(ism==-1) { continue; } else if(ism+n>=0 && ism+n<=5) { sum++; } else { continue; } } } printf("%d",sum); } */ #include<stdio.h> int main() { int m,d; scanf("%d %d",&m,&d); }
0
0
1
최준우
2024년 4월 21일
In 소스 코드 제출
/* #include <stdio.h> int main() { int p[100001]={}; // p[i] =0 : i°¡ ¼Ò¼ö´Ù int n; int i,j; int max=0; scanf("%d",&n); for(i=2 ; i*i<=n ; i++) { if(p[i]==0) { for(j=i*i ; j<=n ; j+=i) { p[j]=1; } } } for(i=2 ; n!=1 ; i++) { if(p[i]==0) { while(1) { if(n%i==0) { if(i>max) { max=i; } n=n/i; } else { break; } } } } printf("%d",max); return 0; } */ /* #include <stdio.h> int main() { long long int n; long long int arr[100001] = {}; long long int max = 0; long long int sum = 0; scanf("%lld", &n); for(long long int i=2; i*i<=n; i++) { while(n%i == 0) { n/=i; sum++; if(sum>max) { max=i; } } sum=0; } if (n>1) { max=n; } printf("%lld", max); return 0; } */ /* #include <stdio.h> int main(){ long long int a = 1; int n,k; scanf("%d %d",&n,&k); for(int i=0 ; i<k ; i++){ a=(a*n)%1000000007; } printf("%lld", a); return 0; } */ /* #include<stdio.h> int main() { int n; int gt,ct; int cnt=0; int min=1001; scanf("%d",&n); for(int i=1 ; i<=n ; i++) { scanf("%d %d",&gt,&ct); if(gt<=ct && ct<min) { min=ct; } else if(gt>ct) { cnt++; } } if(cnt==n) { printf("-1"); return 0; } printf("%d",min); } */ /* #include<stdio.h> int pxy[9][2]={{-1,-1},{0,-1},{1,-1},{-1,0},{1,0},{-1,1},{0,1},{1,1}}; int arr[30][30]={}; void f(int i,int j) { int sum=0; for(int p=0;p<8;p++) { sum+=arr[i+pxy[p][0]][j+pxy[p][1]]; } if(arr[i][j]==0 && sum==3) { printf("1 "); } else if(arr[i][j]==1 && (sum>=4 || sum<=1)) { printf("0 "); } else if(arr[i][j]==1 && (sum==2 || sum==3)) { printf("1 "); } else { printf("0 "); } } int main() { for(int i=1 ; i<=25 ; i++) { for(int j=1 ; j<=25 ; j++) { scanf("%d",&arr[i][j]); } } for(int i=1 ; i<=25 ; i++) { for(int j=1 ; j<=25 ; j++) { f(i,j); } printf("\n"); } } */ #include<stdio.h> int stack[100001]={}; int top=-1; int arr[10000001]={}; void push(int data) { top++; stack[top] = data; } int pop() { if(top!=-1) { return stack[top--]; } } int main() { int n; scanf("%d",&n); for(int i=1 ; i<=n; i++) { scanf("%d",&arr[i]); for(int j=i ; j>=1; j--) { if() { } } } } /* 나를 볼 수 있는 소의 갯수 세는 용도로 스택 0 1 1 2 0 1 */
0
0
1
최준우
2024년 4월 07일
In 소스 코드 제출
//#include <stdio.h> //int n; //long long int f(int k){ // if(k==1) return n; // // long long int x = f(k/2)%1000000007; // x = x*x%1000000007; // if(k%2==0) {return x;} // else {return x*n%1000000007;} //} //int main() { // int k; // scanf("%d %d",&n,&k); // printf("%lld", f(k)); //} //#include <stdio.h> //int main() { // int p[10001]={}; // int n; // int sum=0; // scanf("%d",&n); // int i,j; // for(i=2 ; i*i<=n ; i++) { // if(p[i]==0) { // for(j=i*i ; j<=n ; j+=i) { // p[j]=1; // } // } // } // for(i=1 ; i<=n ; i++) { // if(p[i]==0) { // sum+=i; // } // } // printf("%d",sum-1); //} //#include<stdio.h> //int main() { // int n; // int h[101]={}; // scanf("%d",&n); // for(int i=1 ; i<=n ; i++) { // scanf("%d",h[i]); // } // if() { // // } //}
0
0
1
최준우
2024년 3월 31일
In 소스 코드 제출
/* #include <stdio.h> int main() { int p[100001]={}; // p[i] =0 : i°¡ ¼Ò¼ö´Ù int n; int i,j; int max=0; scanf("%d",&n); for(i=2 ; i*i<=n ; i++) { if(p[i]==0) { for(j=i*i ; j<=n ; j+=i) { p[j]=1; } } } for(i=2 ; n!=1 ; i++) { if(p[i]==0) { while(1) { if(n%i==0) { if(i>max) { max=i; } n=n/i; } else { break; } } } } printf("%d",max); return 0; } */ /* #include <stdio.h> int main() { long long int n; long long int arr[100001] = {}; long long int max = 0; long long int sum = 0; scanf("%lld", &n); for(long long int i=2; i*i<=n; i++) { while(n%i == 0) { n/=i; sum++; if(sum>max) { max=i; } } sum=0; } if (n>1) { max=n; } printf("%lld", max); return 0; } */ #include <stdio.h> int main(){ long long int a = 1; int n,k; scanf("%d %d",&n,&k); for(int i=0 ; i<k ; i++){ a=(a*n)%1000000007; } printf("%lld", a); return 0; }
0
0
2
최준우
2024년 3월 17일
In 소스 코드 제출
#include<stdio.h> int main() { long long int n; long long int max=0; long long int sum=0; scanf("%lld",&n); for(int i=2 ; i<=n; i++) { if(n%i==0) { for(int k=1 ; k<=i ; k++) { if(i%k==0) { sum++; if(sum>2) { break; } } } if(sum==2) { if(i>max) { max=i; } sum=0; } } } printf("%lld",max); return 0; }
0
0
1
최준우
2024년 3월 10일
In 소스 코드 제출
/* // for(int i=4; i<=num ; i++) { // n=arr[i-1][0]; // int a=1; // //i-1번째줄 훑으면서 i번째줄 채우기 // printf("%d 번째 줄 : ",i); // for(int j=0;arr[i-1][j]!=0;j++) { // printf("(%d) ",j); // if(arr[i-1][j+1]==n) { // cnt++; // printf("%d는 %d개 > ",n,cnt); // } // else { // arr[i][a++]=n; // arr[i][a++]=cnt; // printf("%d %d >",arr[i][a-2],arr[i][a-1]); // cnt=1; // n=arr[i-1][j+1]; // } // } // printf("\n"); // } */ /* #include<stdio.h> int arr[25][100]={{0},{1},{1,1},{1,2},{1,1,2,1}}; int main() { int num; int n; int cnt=1; scanf("%d",&num); for(int i=4 ; i<=num ; i++) { for(int j=0 ; arr[i][j+1]!=0 ; j++) { n=arr[i][j]; if(n==arr[i][j+1]) { cnt++; } else { arr[i][j+1]=cnt; cnt=1; } } } for(int i=1; i<=num ; i++) { for(int j=0;arr[i][j]!=0;j++) { printf("%d ",arr[i][j]); } printf("\n"); } } */ //n;a[9999]={1,1};main(){scanf("%d",&n);for(int i=2;i<n;i++)a[i]=a[a[i-1]-1]+a[i-a[i-1]];printf("%d",a[n-1]);} //#include<stdio.h> //int main() { // int n; // int arr[10001]={}; // scanf("%d",&n); // int j=2; // int k=0; // for(int i=2 ; n!=0 ; i++) { // printf("%d ",i); // while(i%k!=0) { // printf("붸레ㅔㄺ "); // k++; // n=n/i; // } // } //} /* #include <stdio.h> int main() { long long int p[10001]={}; // p[i] =0 : i가 소수다 long long int n; int i,j; long long int max=0; scanf("%lld",&n); for(i=2 ; i*i<=n ; i++) { if(p[i]==0) { for(j=i*i ; j<=n ; j+=i) { p[j]=1; } } } for(i=2 ; n!=1 ; i++) { if(p[i]==0) { while(1) { if(n%i==0) { if(i>max) { max=i; } n=n/i; } else { break; } } } } printf("%lld",max); return 0; } */ #include<stdio.h> int main() { int n; int max=0; scanf("%d",&n); for(int i=2 ; i<=n ; i++) { if(n%i==0) { for(int j=2 ; j<i ; i++) { if(i%j==0) { if(i>max) { max=i; } } } } } printf("%d",max); return 0; }
0
0
2
최준우
2024년 3월 10일
In 소스 코드 제출
for(i=2 ; i*i<=b ; i++) { if(p[i]==0) { for(j=i*i ; j<=b ; j+=i) { p[j]=1; } } }
0
0
3
최준우
2024년 2월 17일
In 소스 코드 제출
=----}}] ]
0
0
3
최준우
2024년 2월 17일
In 소스 코드 제출
#include<stdio.h> int main() { int arr[101][101]={}; int i=0; int j=0; int n,m; int k=1; int cnt2=0; int cnt=0; scanf("%d %d",&n,&m); while(k!=n*m+1) { arr[i][j]=k++; i++; j--; if(j<0 || i>=n) { if(cnt<m-1) { cnt++; i=0; j=cnt; } else if(cnt>=m-1) { cnt2++; j=m-1; i=cnt2; } } } for(int i=0; i<n ; i++) { for(int j=0 ; j<m ; j++) { printf("%d ",arr[i][j]); } printf("\n"); } }
0
0
2
최준우
2024년 1월 28일
In 소스 코드 제출
#include<stdio.h> int main() { int arr[101][101]={}; int k=1; int n; int i=1; int j=1; int cnti=0; int cntj=0; scanf("%d",&n); // 1. 맨 겉 달팽이 채우기 while(1) { } //2. 안쪽 달팽이 채우기 //3. 달팽이 출력하기 for(int i=1 ; i<=n; i++) { for(int j=1 ; j<=n ; j++) { printf("%d ",arr[i][j]); } printf("\n"); } }
0
0
3
최준우
2023년 11월 18일
In 소스 코드 제출
import java.io.(http://java.io)*; import java.util.Scanner; import java.util.Vector; import javax.security.(http://javax.security)auth.login.FailedLoginException; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame{ JLabel word[] = new JLabel[30]; JTextField tf = new JTextField(); JLabel h[] = new JLabel[6]; ImageIcon gameover = new ImageIcon("gameover.png"); JLabel gover = new JLabel(gameover); JButton yes = new JButton("Yes"); JButton no = new JButton("No"); JPanel zone = new JPanel(); JLabel yn = new JLabel("Next word(y/n)"); Container c; static int cnt=0; static int hcnt=0; static int cor_cnt=0; static String now_string; static Scanner w = new Scanner(System.in)(http://System.in); static Vector<String> wordVector = new Vector<String>(); public void init() { zone.setLayout(new FlowLayout()); zone.setSize(750,100); zone.setBackground(Color.CYAN); zone.setLocation(80,80); for(int i=0;i<5;i++){ h[i] = new JLabel(new ImageIcon("하트.png")); c.add(h[i]); h[i].setSize(32,32); h[i].setLocation(750+32*i,10); } gover.setSize(950,700); gover.setLocation(0,0); tf.setFont(new Font("Arial", Font.PLAIN, 120)); tf.setForeground(Color.BLACK)(http://Color.BLACK); tf.setText("a"); tf.setSize(130,130); tf.setLocation(400,300); yes.setSize(120,120); yes.setLocation(320,300); no.setSize(120,120); no.setLocation(470,300); c.add(gover); gover.setVisible(false); c.add(tf); c.add(zone); } public void game_start() { cor_cnt=0; //1. 랜덤 단어 위치 구하기 int x = (int)(Math.random()*25143); //int w; String rd_str = wordVector.get(x); now_string=rd_str; System.out.println(rd_str); //rd_str의 각 문자를 레이블로 나누어서 넣기 for(int i=0;i<rd_str.length();i++) { word[i] = new JLabel("_"); zone.add(word[i]); word[i].setFont(new Font("Arial", Font.PLAIN,80)); c.repaint(); c.revalidate(); } tf.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { if(tf.getText().length()==0) { return; } char w = tf.getText().charAt(0); //입력한 문자 //w가 문자열 내부에서 같은 문자가 있다면 그 위치의 문자를 보여주도록 바꾸기 int isfind=0; for(int i=0 ; i<rd_str.length() ; i++) { if(word[i].getText().equals("_")) { //빈 칸을 만났으면? if(w == rd_str.charAt(i) || 'A'<=w && 'Z'>=w && w+32 == rd_str.charAt(i) || 'a'<=w && 'z'>=w && w-32 == rd_str.charAt(i) ) { word[i].setText(rd_str.charAt(i)+""); cor_cnt++; isfind=1; System.out.println("cor_cnt :"+cor_cnt); } } else if(word[i].getText().equals(w+"")){ isfind=1; break; } } if(isfind==0) hcnt++; for(int i=0 ; i<hcnt ; i++) { h[i].setVisible(false); if(hcnt==5) { System.out.println("게임 종료"); gover.setVisible(true); tf.setVisible(false); } } // h5.setVisible(false); // System.out.println("게임 종료"); // gover.setVisible(true); // tf.setVisible(false); //System.exit(0); if(cor_cnt == rd_str.length()) { System.out.println("성공함"); zone.removeAll(); //zone패널 내부의 컴포넌트 모두 삭제 zone.add(yn); yn.setFont(new Font("Arial", Font.PLAIN, 80)); zone.repaint(); zone.revalidate(); c.remove(tf); c.add(yes); c.add(no); //word[i].setText("next word(y/n)"); if(w == 'y') { c = new Main();//다시시작 } if(w == 'n') { System.exit(0); } } //단어를완성했는지?( 맞힌 문자 갯수==단어의길이) tf.setText(""); } } }); } public Main() { setTitle("HangMan"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c = getContentPane(); c.setLayout(null); setSize(950,700); setVisible(true); init(); game_start(); } public static void main(String[] args) { InputStreamReader in = null; FileInputStream fin = null; try { fin = new FileInputStream("C:\\Users\\user\\Desktop\\words.txt"); in = new InputStreamReader(fin); int c; Scanner s = new Scanner(new FileReader("C:\\Users\\user\\Desktop\\words.txt")); while(s.hasNext()) { String word = s.nextLine(); wordVector.add(word); } in.close(); fin.close(); } catch(IOException e) { } new Main(); } } /* 0. 하트 코드 반복문과 배열을 사용해서 줄이기******완료 1. (다이얼로그)로그인기능 (개인별 점수 기록 기능) 2. 랭킹확인 버튼 3. 점수 기준 정하기 ( 연속으로 맞추면 콤보.. 추가점수) *** 새로운 시도를 하기 전에 꼭!!! 백업하기*****(메일에) 4. 그 단어의 정답률 보여주기 5. 이외 아이디어 생각해서 추가하기 */
0
0
1
최준우
2023년 11월 12일
In 소스 코드 제출
import java.io.(http://java.io)*; import java.util.Scanner; import java.util.Vector; import javax.security.(http://javax.security)auth.login.FailedLoginException; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Main extends JFrame{ JLabel word[] = new JLabel[30]; JTextField tf = new JTextField(); ImageIcon ht1 = new ImageIcon("하트.png"); JLabel h1 = new JLabel(ht1); ImageIcon ht2 = new ImageIcon("하트.png"); JLabel h2 = new JLabel(ht2); ImageIcon ht3 = new ImageIcon("하트.png"); JLabel h3 = new JLabel(ht3); ImageIcon ht4 = new ImageIcon("하트.png"); JLabel h4 = new JLabel(ht4); ImageIcon ht5 = new ImageIcon("하트.png"); JLabel h5 = new JLabel(ht5); JButton yes = new JButton(); JButton no = new JButton(); JPanel zone = new JPanel(); Container c; static int cnt=0; static int hcnt=0; static int cor_cnt=0; static String now_string; static Scanner w = new Scanner(System.in)(http://System.in); static Vector<String> wordVector = new Vector<String>(); public void init() { zone.setLayout(new FlowLayout()); zone.setSize(750,100); zone.setBackground(Color.CYAN); zone.setLocation(80,80); h1.setSize(32,32); h1.setLocation(750,20); h2.setSize(32,32); h2.setLocation(782,20); h3.setSize(32,32); h3.setLocation(814,20); h4.setSize(32,32); h4.setLocation(846,20); h5.setSize(32,32); h5.setLocation(878,20); tf.setFont(new Font("Arial", Font.PLAIN, 120)); tf.setForeground(Color.BLACK)(http://Color.BLACK); tf.setText("a"); tf.setSize(130,130); tf.setLocation(400,300); c.add(tf); c.add(zone); c.add(h1); c.add(h2); c.add(h3); c.add(h4); c.add(h5); } public void game_start() { cor_cnt=0; //1. 랜덤 단어 위치 구하기 int x = (int)(Math.random()*25143); //int w; String rd_str = wordVector.get(x); now_string=rd_str; System.out.println(rd_str); //rd_str의 각 문자를 레이블로 나누어서 넣기 for(int i=0;i<rd_str.length();i++) { word[i] = new JLabel("_"); zone.add(word[i]); word[i].setFont(new Font("Arial", Font.PLAIN,80)); c.repaint(); c.revalidate(); } tf.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { if(tf.getText().length()==0) { return; } char w = tf.getText().charAt(0); //w가 문자열 내부에서 같은 문자가 있다면 그 위치의 문자를 보여주도록 바꾸기 for(int i=0 ; i<rd_str.length() ; i++) { if(hcnt >= 1) { h1.setVisible(false); } if(hcnt >= 2) { h2.setVisible(false); } if(hcnt >= 3) { h3.setVisible(false); } if(hcnt >= 4) { h4.setVisible(false); } if(hcnt >= 5) { h5.setVisible(false); System.out.println("게임 종료"); System.exit(0); } if(word[i].getText().equals("_")) { if(w == rd_str.charAt(i) || 'A'<=w && 'Z'>=w && w+32 == rd_str.charAt(i) || 'a'<=w && 'z'>=w && w-32 == rd_str.charAt(i) ) { word[i].setText(rd_str.charAt(i)+""); cor_cnt++; System.out.println(cor_cnt); } } else { hcnt++; } } if(cor_cnt == rd_str.length()) { System.out.println("성공함"); } //단어를완성했는지?( 맞힌 문자 갯수==단어의길이) tf.setText(""); } } }); } public Main() { setTitle("HangMan"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); c = getContentPane(); c.setLayout(null); setSize(950,700); setVisible(true); init(); game_start(); } public static void main(String[] args) { InputStreamReader in = null; FileInputStream fin = null; try { fin = new FileInputStream("C:\\Users\\user\\Desktop\\words.txt"); in = new InputStreamReader(fin); int c; Scanner s = new Scanner(new FileReader("C:\\Users\\user\\Desktop\\words.txt")); while(s.hasNext()) { String word = s.nextLine(); wordVector.add(word); } in.close(); fin.close(); } catch(IOException e) { } new Main(); } }
0
0
1
최준우
2023년 11월 05일
In 소스 코드 제출
0
0
3
최준우
2023년 11월 05일
In 소스 코드 제출
/* import java.io.(http://java.io)FileReader; import java.io.(http://java.io)IOException; public class Main{ public static void main(String[] args) { FileReader fin = null; try { fin = new FileReader("c:/windows/system.ini"); int c; while((c = fin.read((http://fin.read))) != -1) { System.out.print((char)c); } fin.close(); } catch(IOException e) { System.out.println("입출력 오류"); } } } */ /* import java.io.(http://java.io)*; public class Main{ public static void main(String[] args) { InputStreamReader in = null; FileInputStream fin = null; try { fin = new FileInputStream("C:\\Users\\user\\Desktop\\앙모찌모찌.txt"); in = new InputStreamReader(fin); int c; System.out.println("인코딩 문자 집합은 " + in.getEncoding()); while((c = in.read((http://in.read))) != -1) { System.out.print((char)c); } in.close(); fin.close(); } catch(IOException e) { System.out.println("입출력 오류"); } } } */ /* import java.io.(http://java.io)*; import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in)(http://System.in); FileWriter fout = null; int c; try { fout = new FileWriter("C:\\Users\\user\\Desktop\\angMoZZiMoZZi.txt"); while(true) { String line = scanner.nextLine(); if(line.length() == 0) break; fout.write(line,0,line.length()); fout.write("\r\n",0,2); System.out.println("문자열 저장됨"); } fout.close(); } catch(IOException e) { System.out.println("입오"); } scanner.close(); } } */ /* import java.io.(http://java.io)*; public class Main { public static void main(String[] args) { byte b[] = {7,51,3,4,-1,24}; try { FileOutputStream fout = new FileOutputStream("C:\\Users\\user\\Desktop\\angMoZZiMoZZi.txt"); for(int i=0 ; i<b.length ; i++) fout.write(b[i]); fout.close(); } catch(IOException e) { System.out.println("C:\\Users\\user\\Desktop\\angMoZZiMoZZi.txt예 죠좡햑 쉬 엵셨솝녜대.귈료뮹율 힉연햆 줅쉐욜"); return; } System.out.println("C:\\Users\\user\\Desktop\\angMoZZiMoZZi.txt읇 죠좡햑옑쒧놰됑."); } } */ /* import java.io.(http://java.io)*; public class Main { public static void main(String[] args) { byte b[] = new byte [6]; try { FileInputStream fin = new FileInputStream("C:\\Users\\user\\Desktop\\angMoZZiMoZZi.txt"); int n=0, c; while((c = fin.read((http://fin.read)))!= -1) { b[n] = (byte)c; n++; } System.out.println("C:\\Users\\user\\Desktop\\angMoZZiMoZZi.txt에서 읽은 배열을 출력합니다"); for(int i=0 ; i<b.length ; i++) System.out.print(b[i] + " "); System.out.println(); fin.close(); } catch(IOException e) { System.out.println("C:\\Users\\user\\Desktop\\angMoZZiMoZZi.txt예 죠좡햑 쉬 엵셨솝녜대.귈료뮹율 힉연햆 줅쉐욜"); } } } 절대 : 그냥 맨 처음부터 절대적으로 어디 있는지? 상대 : 나를 기준으로 상대적인 경로 */ import java.io.(http://java.io)*; import java.util.Scanner; import java.util.Vector; public class Main { public static void main(String[] args) { InputStreamReader in = null; FileInputStream fin = null; Vector<String> wordVector = new Vector<String>(); try { fin = new FileInputStream("C:\\Users\\user\\Desktop\\words.txt"); in = new InputStreamReader(fin); int c; Scanner s = new Scanner(new FileReader("C:\\Users\\user\\Desktop\\words.txt")); while(s.hasNext()) { String word = s.nextLine(); wordVector.add(word); } int x = (int)(Math.random()*25143); String rd_str = wordVector.get(x); System.out.println(rd_str); for(int i=0; i<=rd_str.length() ; i++) { rd_str } //if(wordVector.contains("abc")) in.close(); fin.close(); } catch(IOException e) { } } }
0
0
1
최준우
2023년 10월 29일
In 소스 코드 제출
/* #include <stdio.h> int queue[401]={}; int front=0; int back=0; void push(int data){ back++; queue[back]=data; } int pop(){ if(front!=back){front++;return queue[front];}; } main(){ int n; char arr[401]={}; scanf("%d\n",&n); for(int i=1;i<=n;i++){ gets(arr); if(arr[0]=='b'){ if(back==front){ printf("-1\n"); } else{ printf("%d\n",queue[back]); } } else if(arr[1]=='u'){ int a=0; for(int j=6;arr[j]!=' ';j++){ a=a*10+arr[j]-48; } push(a); } else if(arr[0]=='p'){ pop(); } else if(arr[0] == 's'){ printf("%d\n", back-front); } else if(arr[0] == 'e'){ if(back == front){ printf("true\n"); } else{ printf("false\n"); } } else if(arr[0] == 'f'){ if(front == back){ printf("-1\n"); } else{ printf("%d\n",queue[front+1]); } } } } */ /* #include<stdio.h> int stack[201]={};int top=-1;void push(int data){top++;stack[top]=data;}int pop(){return stack[top--];} int main() { char a[101]={}; char b[101]={}; int olim=0; scanf("%s %s",a,b); int i=strlen(a)-1; int j=strlen(b)-1; for(;;) { int x = a[i]-'0'; if(i<0) x=0; int y = b[j]-'0'; if(j<0) y=0; int num = (olim+x+y); push(num%10); olim=num/10; if(i>=0)i--; if(j>=0)j--; if(i==-1 && j==-1)break; } if(olim!=0) { push(olim); } while(top != -1) { printf("%d",pop()); } } */ #include<stdio.h> int stack[201]={}; int top=-1; void push(int data) { top++; stack[top]=data; } int pop() { return stack[top--]; } int main() { char arr[201]={}; gets(arr); for(int i=0 ; i<strlen(arr) ; i++) { if() { } } }
0
0
1
최준우
2023년 10월 28일
In 소스 코드 제출
/* #include <stdio.h> int stack[201]={}; int top=-1; void push(int data) { top++; stack[top] = data; } int pop() { if (top != -1) { return stack[top--]; } } int main() { int n; char arr[201]={}; scanf("%d\n",&n); for (int i=1 ; i<=n ; i++){ gets(arr); if (arr[0] == 't') { if (top == -1) { printf("-1\n"); } else { printf("%d\n", stack[top]); } } else if (arr[1] == 'u') { int num=0; for(int j=6 ; arr[j]!=' ' ; j++) { num=num*10+arr[j] - 48; } push(num); } else if (arr[0] == 'p') { if (top != -1) { top--; } } else if (arr[0] == 's') { printf("%d\n", top+1); } else if (arr[0] == 'e') { if (top == -1) { printf("true\n"); } else { printf("false\n"); } } } } */ #include<stdio.h> int queue[201]={}; int front = 0; int back = 0; void push(int data) { back++; queue[back] = data; } int pop() { if(front != back) { return queue[front++]; } else { front=0; back=0; } } int main() { int n; char arr[201]={}; scanf("%d\n",&n); for(int i=1 ; i<=n ; i++) { gets(arr); if (arr[0] == 'b') { if (back == 0) { printf("-1\n"); } else { printf("%d\n", queue[back]); back--; } } else if (arr[1] == 'u') { int a=0; for(int j=6 ; arr[j]!=' ' ; j++) { a=a*10+arr[j] - 48; } push(a); } else if (arr[0] == 'p') { pop(); } else if (arr[0] == 's') { printf("%d\n", back+1); } else if(arr[0] == 'e') { if(back == 0) { printf("true\n"); } else { printf("false\n"); } } else if(arr[0] == 'f') { if(front == 0) { printf("-1\n"); } else { printf("%d\n",queue[front]); } } } }
0
0
2
최준우
2023년 10월 21일
In 소스 코드 제출
#include<stdio.h> int stack[1001]={}; int top = 0; void push(int data) { top++; stack[top] = data; } int pop() { return stack[top--]; } int main() { int n; int a = 0; int check = 0; int f[1001]={}; char sx[1001]={}; scanf("%d",&n); for(int i=0; i<n; i++) { scanf("%d", &f[i]); } for(int i=0; i<n ; i++) { push(f[i]); sx[a] = 'S'; a++; printf("I : %d, F[i] : %d\n",i,f[i]); printf("stack[top-1] : %d\n",stack[top-1]); printf("f[check] : %d\n",f[check]); if(stack[top-1] == f[check]) { printf("반복문 전 TOP-1 : %d, CHECK : %d\n",stack[top-1],check); while(1) { pop(); check++; sx[a] = 'X'; a++; printf("반복문 안 TOP-1 : %d, CHECK : %d\n",stack[top-1],check); if(stack[top-1] != f[check]) { //printf("TOP-1 : %d, CHECK : %d\n",stack[top-1],check); break; } } } } if(check == f[n] && top == 0) { printf("%s",sx); } else { printf("IMPOSSIBLE\n"); printf("TOP-1 : %d, CHECK : %d\n",stack[top-1],check); printf("CHECK :%d, TOP : %d",check,top); } }
0
0
2
최준우
2023년 10월 21일
In 소스 코드 제출
#include<stdio.h> int stack[1001]={}; int top = -1; void push(int data) { top++; stack[top] = data; } int pop() { return stack[top--]; } int main() { int n; int j=0; int topp = 1; char sx[1001]={}; int t[1001]={}; scanf("%d",&n); for(int i=1 ; i<=n ; i++) { scanf("%d",&t[i]); } for(int i=1 ; i<=n*2 ; i++) { sx[j] = 'S'; j++; if(topp == t[i]) { topp++; sx[j] = 'X'; push(sx[j]); j++; while(topp != t[i]) { topp++; sx[j] = 'X'; push(sx[j]); j++; } } } printf("%s",sx); }
0
0
2
최준우
2023년 10월 08일
In 소스 코드 제출
/* #include<stdio.h> int stack[1001]={}; int top = -1; void push(int data) { top++; stack[top] = data; } int pop() { return stack[top--]; } int main() { int n,t; scanf("%d",&n); for(int i=1 ; i<=n ; i++) { scanf("%d",&t); push(t); } while(top != -1) { printf("%d ",pop()); } } */ /* #include<stdio.h> #include<string.h> char stack[100]={}; int top = -1; void push(char data) { top++; stack[top] = data; } char pop() { return stack[top--]; } int main() { char a[100]={}; scanf("%s",a); for(int i=0 ; a[i]!=NULL ;i++) { push(a[i]); } while(top != -1) { printf("%c",pop()); } } */ /* #include<stdio.h> int stack[100001]={}; int top = -1; void push(int data) { top++; stack[top] = data; } int pop() { if(top != -1) { return stack[top--]; } } int main() { int n; int sum=0; int t; scanf("%d",&n); for(int i=1 ; i<=n ; i++) { scanf("%d",&t); if(t == 0) { pop(); } else { push(t); } } while(top != -1) { sum+=pop(); } printf("%d",sum); return 0; } */ /* #include<stdio.h> char stack[201]={}; int top = -1; void push(char data) { top++; stack[top]=data; } char pop() { if(top != -1) { return stack[top--]; } } int main() { int n; int cnt=0; char a[201]={}; scanf("%d",&n); scanf("%s",a); for(int i=n-1 ; i>=0 ; i--) { push(a[i]); cnt++; if(cnt%3==0 && i!=0) { push(','); } } while(top != -1) { printf("%c",pop()); } } */ #include<stdio.h> int t = 0; int main() { char a[50001]={}; int rcnt = 0; int lcnt = 0; scanf("%s",a); for(int i=0 ; a[i]!=NULL ; i++) { if(a[i] == '('){ t++; } else if(a[i] == ')') { t--; if(t < 0) { printf("bad"); return 0; } } } printf(t == 0 ? "good" : "bad"); return 0; }
0
0
3
최준우
2023년 10월 07일
In 소스 코드 제출
/* #include <stdio.h> int arr[200]={0,1,1}; int x, y; void f(int k){ if(k>=x+1) { y=arr[k-1]%10009; printf("%d", y); return; } else{ arr[k]=arr[k-1]+arr[k-2]; f(k+1); } } int main() { scanf("%d", &x); f(3); return 0; } */ #include<stdio.h> int top = -1; int a[100001]={}; int n; int sum=0; void push(int data) { top++; a[top] = data; } void pop() { top--; } int main() { scanf("%d",&n); for(int i=1 ; i<=n ; i++) { if(a[i] == 0) { pop(); sum-=top; } else { push(a[i]); sum+=top; } } printf("%d",sum); }
0
0
1

최준우

더보기
bottom of page