import java.util.Scanner;
public class MyClass {
public static void main(String args[]) {
boolean for_demitido=true;
boolean chegarei_cedo=for_demitido;
System.out.println("chegarei_cedo = " + chegarei_cedo);
Scanner sc = new Scanner (System.in);
int temperatura = sc.nextInt();
boolean estiver_quente = temperatura>=27;
boolean nao_tiver_tarefas = false;
nao_tiver_tarefas = for_demitido;
boolean vou_aa_praia = estiver_quente & nao_tiver_tarefas;
System.out.println ("vou_aa_praia =" +vou_aa_praia);
if (vou_aa_praia) {
System.out.println ("#partiupraia");
} else {
System.out.println ("#Ebahcasa!");
}
}
}
Este é o blog de relacionamento com alunos de Fábio Nakano.
Desejo testar se esta mídia facilita a comunicação e aprendizado de conteúdo.
Gostaria que vocès dessem notas mais altas para posts que ajudaram mais a entender o assunto (e não por outro critério, por exemplo o melhor escrito ou o mais "bonito")
fabionakano at usp dot br
Prédio A1, segundo andar - Sala 204E
Caso precise do mapa do Campus:http://each.uspnet.usp.br/site/mapa.php
Siga-me por email preenchendo a caixa abaixo.
sexta-feira, 16 de março de 2018
sexta-feira, 17 de novembro de 2017
//*******************************************************************
// Dear CompileJava users,
//
// CompileJava has been operating since 2013 completely free. If you
// find this site useful, or would otherwise like to contribute, then
// please consider a donation (link in 'More Info' tab) to support
// development of the new CompileJava website (stay tuned!).
//
// Most sincerely, Z.
//*******************************************************************
import java.lang.Math; // headers MUST be above the first class
// one class needs to have a main() method
public class HelloWorld
{
static char[] C={'a', 'b', 'c'};
static char[] R= {' ', ' ', ' '};
static void combina (int m) {
if (m==0) {
System.out.println (R);
return;
}
int i=0;
while (i<C.length) {
// tem combina
//System.out.print (C[i]);
R[m-1]=C[i];
combina(m-1);
i++;
}
}
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
combina (3);
}
}
// Dear CompileJava users,
//
// CompileJava has been operating since 2013 completely free. If you
// find this site useful, or would otherwise like to contribute, then
// please consider a donation (link in 'More Info' tab) to support
// development of the new CompileJava website (stay tuned!).
//
// Most sincerely, Z.
//*******************************************************************
import java.lang.Math; // headers MUST be above the first class
// one class needs to have a main() method
public class HelloWorld
{
static char[] C={'a', 'b', 'c'};
static char[] R= {' ', ' ', ' '};
static void combina (int m) {
if (m==0) {
System.out.println (R);
return;
}
int i=0;
while (i<C.length) {
// tem combina
//System.out.print (C[i]);
R[m-1]=C[i];
combina(m-1);
i++;
}
}
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
combina (3);
}
}
sexta-feira, 27 de outubro de 2017
Código para atividade 2
public class HelloWorld
{
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
Comparador.inicio();
for (int i=0;Comparador.menor (i,10);i++) {
System.out.println (i);
}
if (Comparador.igual(0,33)) System.exit (0);
Comparador.fim();
Comparador.imprimeResultado(); }
}
public class Comparador
{
static long tI, tF;
static int nComp;
Comparador () {
tI=0;tF=0;nComp=0;
}
public static void reIniciaTempo() {
tI=0;tF=0;
}
public static void reIniciaComp() {
nComp=0;
}
public static boolean igual (int a, int b) {
nComp++;
return a==b;
}
public static boolean menor (int a, int b) {
nComp++;
return a<b;
}
public static void inicio () {
tI=System.nanoTime();
}
public static void fim () {
tF=System.nanoTime();
}
public static void imprimeResultado () {
System.out.println ("Tempo transcorrido = " + (tF-tI));
System.out.println ("Comparações efetuadas = " + nComp);
}
}
{
// arguments are passed using the text field below this editor
public static void main(String[] args)
{
Comparador.inicio();
for (int i=0;Comparador.menor (i,10);i++) {
System.out.println (i);
}
if (Comparador.igual(0,33)) System.exit (0);
Comparador.fim();
Comparador.imprimeResultado(); }
}
public class Comparador
{
static long tI, tF;
static int nComp;
Comparador () {
tI=0;tF=0;nComp=0;
}
public static void reIniciaTempo() {
tI=0;tF=0;
}
public static void reIniciaComp() {
nComp=0;
}
public static boolean igual (int a, int b) {
nComp++;
return a==b;
}
public static boolean menor (int a, int b) {
nComp++;
return a<b;
}
public static void inicio () {
tI=System.nanoTime();
}
public static void fim () {
tF=System.nanoTime();
}
public static void imprimeResultado () {
System.out.println ("Tempo transcorrido = " + (tF-tI));
System.out.println ("Comparações efetuadas = " + nComp);
}
}
sexta-feira, 20 de outubro de 2017
Interface para Atividade 1
O próximo passo é testar esta estrutura: medir tempos de inserção, remoção e busca, contar comparações, em conjuntos de dados pequenos e grandes, graficar, ajustar as escalas e verificar se o que se sabe na teoria é confirmado.
01 /** A classe que implementar esta interface deve ocultar sua estrutura interna.
|
| Java2html |
terça-feira, 26 de setembro de 2017
MergeSort
01 class Teste {
|
| Java2html |
sábado, 12 de agosto de 2017
Algoritmo tentativa e erro (incompleto) escrito na aula de 11.08.2017
/** INCOMPLETO: completar! */
|
| Java2html |
Algoritmo guloso escrito na aula de 11.08.2017
public class MyClass {
|
| Java2html |
Assinar:
Postagens (Atom)